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

Using golang.org/x/sync/errgroup, you call g, ctx := errgroup.WithContext(parent) and launch several g.Go workers. One worker returns a non-nil error. What does errgroup do regarding ctx and the returned error?

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