Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardGothe race detectorSingle-choice MCQ

The race detector (-race) instruments memory accesses and reports a race in the program below. Which statement about WHY it fires is correct?

func main() { x := 0 done := make(chan struct{}) go func() { x = 42 done <- struct{}{} }() _ = x // racy read <-done fmt.Println(x) }