package config import ( "gopkg.in/yaml.v2" "io/ioutil" "log" ) type Config struct { LineCharts []LineChartConfig `yaml:"line-charts"` } func Load(location string) *Config { yamlFile, err := ioutil.ReadFile(location) if err != nil { log.Fatalf("Can't read config file: %s", location) } cfg := new(Config) err = yaml.Unmarshal(yamlFile, cfg) if err != nil { log.Fatalf("Can't read config file: %v", err) } return cfg }