Last Updated: May 22, 2026
sync.WaitGroup waits for a fan-out of goroutines to finish, but it doesn't help with two problems that show up constantly in real code: collecting an error from a failed worker, and cancelling the siblings when one of them fails. errgroup.Group from golang.org/x/sync/errgroup is WaitGroup plus an error channel plus a cancellable context, bundled into one small type. It's the standard way Go programmers fan out work that can fail.