Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumGosync.WaitGroupSingle-choice MCQ

What is the defect in this WaitGroup usage?

var wg sync.WaitGroup for i := 0; i < 5; i++ { go func() { wg.Add(1) defer wg.Done() work() }() } wg.Wait()