Canonical guidance

Use when

Avoid

Preferred pattern

g, ctx := errgroup.WithContext(ctx)
g.Go(func() error {
	return worker(ctx)
})
return g.Wait()

Anti-pattern

go syncAllCaches()

Explanation: This anti-pattern is common because fire-and-forget feels simple, but unowned goroutines become leak, shutdown, and observability problems.

Why

Related pages

Sources