package main import ( "gopkg.in/yaml.v2" "io/ioutil" "log" ) type CompCfg struct { Name string `yaml:"Name"` URL string `yaml:"URL"` } type Suite struct { Name string `yaml:"Name"` Components []CompCfg `yaml:"Components"` } type ReleaseCfg struct { Release string `yaml:"Release"` RepoURL string `yaml:"RepoURL"` Suites []Suite `yaml:"Suites"` } type PkgwebCfg struct { PkgSets []ReleaseCfg `yaml:"PkgSets"` } func readConfig(fname string) *PkgwebCfg { data, err := ioutil.ReadFile(fname) if err != nil { log.Fatal("Error while reading file: ", err) } cfg := new(PkgwebCfg) err = yaml.Unmarshal(data, cfg) if err != nil { log.Fatal("Error while reading configuration: ", err) } return cfg }