Skip to content

waitgroup-go-forbidden-call

Reject panic, recover, and WaitGroup.Done inside WaitGroup.Go.

Updated View as Markdown

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.

Bad

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

Good

group.Go(func() {
	work()
})
Navigation

Type to search…

↑↓ navigate↵ selectEsc close