← Go Lesson 6

Lesson 6: sync, atomic & the Race Detector

8 min read

1. Q1: Why should you use defer mu.Unlock() instead of calling it at the end?

2. Q2: What's wrong with calling wg.Add(1) inside the goroutine?

3. Q3: The race detector finds: