go - golang viper yaml parsing a list of maps -
yaml alwyas gives me headache...
i trying parse yaml config file using spf13/viper easy, giving me trouble here
type container struct { name string `yaml:"name"` maxcpu int64 `yaml:"max-cpu"` maxmem int64 `yaml:"max-mem"` minprocs int64 `yaml:"min-procs"` } // conf struct combines containers , email settings structs type conf struct { containers []container `yaml:"containers"` email email `yaml:"email_addresses"` postman postman `yaml:"email_settings"` }
the yaml file trying parse...
--- containers: - name: container1 max-cpu: 2
viper's unmarshal function pretty straightforward , don't think problem is, somewhere in yaml formatting. parsed struct looks in terminal...
{[{container1 0 0 0}] { [] []} { }}
Comments
Post a Comment