Why is the double-checked locking pattern below still racy under the Go memory model, even though once is guarded by the mutex on the slow path?
var mu sync.Mutex
var inited bool
var instance *T
func get() *T {
if inited { // unsynchronized read
return instance
}
mu.Lock()
defer mu.Unlock()
if !inited {
instance = &T{}
inited = true
}
return instance
}