[Solved] Why is WaitGroup.Wait() hanging when using it with go test? [duplicate]
[ad_1] Two issues: don’t copy sync.WaitGroup: from the docs: A WaitGroup must not be copied after first use. you need a wg.Add(1) before launching your work – to pair with the wg.Done() wg.Add(1) // <- add this go func (wg *sync.WaitGroup …) { // <- pointer }(&wg, quitSig) // <- pointer to avoid WaitGroup copy … Read more