mirror of
https://github.com/lukaszraczylo/kportal.git
synced 2026-06-09 23:59:45 +00:00
b7b297c576
The mock recorded calls into unprotected slices while being invoked concurrently from the test goroutine and from the health-checker callback registered by Manager.startWorker (and the watchdog hung callback). go test -race -count=20 reliably tripped the race detector on TestStartWorker_HealthCallback_StatusChange. Wrap the slice writes in a sync.Mutex. Read-side code in tests reads only after manager.Stop() drains the background goroutines (Stop's wg.Wait establishes a happens-before edge), so direct reads remain race-free.