Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardGoGo memory modelSingle-choice MCQ

Per the Go memory model, what does the code below guarantee about the value printed (assume no other synchronization)?

var a int func main() { done := make(chan bool) go func() { a = 1 _ = a done <- true }() fmt.Println(a) // racing read, no recv before this <-done }