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

This program uses sync.Once. Beyond ensuring f runs only once, what happens-before guarantee does once.Do(f) provide, and how does it affect the read of config?

var once sync.Once var config *Config func Get() *Config { once.Do(func() { config = load() }) return config }