1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 08:35:57 +01:00

Fix api_test.go under Go 1.20.

This commit is contained in:
Juliusz Chroboczek 2024-08-13 16:26:08 +02:00
parent dd979652c2
commit 1bb7172515

View file

@ -18,16 +18,20 @@ import (
"github.com/jech/galene/token" "github.com/jech/galene/token"
) )
var setupOnce = sync.OnceFunc(func() { var setupOnce sync.Once
Insecure = true
err := Serve("localhost:1234", "") func setup() {
if err != nil { setupOnce.Do(func() {
panic("could not start server") Insecure = true
} err := Serve("localhost:1234", "")
}) if err != nil {
panic("could not start server")
}
})
}
func setupTest(dir, datadir string) error { func setupTest(dir, datadir string) error {
setupOnce() setup()
group.Directory = dir group.Directory = dir
group.DataDirectory = datadir group.DataDirectory = datadir