Skip to content

waitgroup-go-forbidden-call

Default severity: error

sync.WaitGroup.Go calls Done automatically when its task returns, and its contract requires the task not to panic. Calling Done manually corrupts the counter; panic and recover indicate a task that does not satisfy the API contract.

group.Go(func() {
defer group.Done()
work()
})
group.Go(func() {
work()
})