package config import ( "sync" "github.com/BurntSushi/toml" ) var ( config map[string]interface{} once sync.Once ) func loadConfig() { if _, err := toml.DecodeFile("config.toml", &config); err != nil { panic(err) } } func GetConfig() map[string]interface{} { once.Do(loadConfig) return config }