单例模式目的:
对象初始化成本比较高,防止一个被屡次初始化。code
var ( confOnce sync.Once // guards init of confVal via initConfVal confVal = &conf{goos: runtime.GOOS} ) // systemConf returns the machine's network configuration. func systemConf() *conf { confOnce.Do(initConfVal) return confVal }