In what scenarios is a sync.WaitGroup more appropriate than using a channel to wait for goroutine completion?

Last updated 20 June 2026

  • Use sync.WaitGroup when you only need to wait for N goroutines to finish and need no return values. It is simpler and cheaper than counting receives on a done-channel.

  • Use channels when goroutines produce results you must collect, aggregate, or stream back.

  • They combine well: workers send results on a channel while a WaitGroup decides when to close() it.

  • https://stackoverflow.com/questions/36056615/what-is-the-advantage-of-sync-waitgroup-over-channels
All Golang interview questions