package main import ( "io/ioutil" "github.com/BurntSushi/toml" ) type config struct { Token string ReportTarget 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 }