Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumGoerrgroup and fan-outSingle-choice MCQ

In a fan-out pattern using errgroup.WithContext, when one goroutine returns an error, how do the OTHER in-flight goroutines learn they should stop?

g, ctx := errgroup.WithContext(context.Background()) for _, u := range urls { u := u g.Go(func() error { return fetch(ctx, u) }) } err := g.Wait()