fr
fr

Question from the Go test

Waiting for validation

The code below contains a flaw can you point towards it?

func worker(id int, wg sync.WaitGroup) {
	defer wg.Done()
	println("worker", id)
}

func main() {
	var wg sync.WaitGroup
	for i := 0; i < 3; i++ {
		wg.Add(1)
		go worker(i, wg)
	}
	wg.Wait()
}
Author: John PendenqueStatus: Waiting for validationQuestion not yet passed
0
Community EvaluationsNo one has reviewed this question yet, be the first!