func main() { config := Config{} err := envtag.Unmarshal(&config) if err != nil { panic(err) } fmt.Println("HOME:", config.Home) fmt.Println("LOCATION:", config.Location) }
func main() { data, err := ioutil.ReadFile("sample.yaml") if err != nil { panic(err) } config := Config{} err = yaml.Unmarshal(data, &config) if err != nil { panic(err) } err = envtag.Unmarshal(&config) if err != nil { panic(err) } fmt.Printf("%+v\n", config) }