Files
golifehk/i18n/race_test.go
2026-03-10 15:18:34 +08:00

32 lines
471 B
Go

package i18n
import (
"sync"
"testing"
)
func TestLoadKeysRace(t *testing.T) {
// Reset shared global state so the test starts clean
LangPacks = map[string]LangPack{}
const goroutines = 200
var wg sync.WaitGroup
wg.Add(goroutines)
start := make(chan struct{})
for i := 0; i < goroutines; i++ {
go func() {
defer wg.Done()
<-start
_, _ = LoadKeys("en")
}()
}
// Release all goroutines at once to maximize overlap
close(start)
wg.Wait()
}