Can you spot the mistake in this code? for i := range 100 { go func() { wg.Add(1) defer wg.Done() fmt.Println(i) }() } wg.Wait() At first glance, this code probably looks fine. We’re calling wg.Add(1) at the beginning of each task. We’re deferring the call to wg.Done(), so it’s called when the function exits. Each Add call has a matching Done call. We’re properly waiting for all tasks to complete with wg.