package main import ( "io/ioutil" "github.com/BurntSushi/toml" ) type config struct { Token string ReportTarget string `toml:"report_target"` LevelRoles []string `toml:"level_roles"` MacroReplace map[string]string `toml:"macro_replace"` Macro map[string]string } func LoadConfig() config { bytes, err := ioutil.ReadFile("config.toml") if err != nil { panic(err) } var cfg config err = toml.Unmarshal(bytes, &cfg) if err != nil { panic(err) } return cfg }