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

You set g.SetLimit(2) on an errgroup.Group, then loop calling g.Go for 100 tasks. What is the effect of SetLimit on the g.Go calls?

g := new(errgroup.Group) g.SetLimit(2) for _, task := range tasks { task := task g.Go(func() error { return process(task) }) } _ = g.Wait()