koding / multiconfig

Load configuration from multiple sources in Go
http://godoc.org/github.com/koding/multiconfig
MIT License
454 stars 64 forks source link

is it right? thanks #63

Closed icoder528 closed 6 years ago

icoder528 commented 7 years ago

code: func main() { var cfg = struct { Name string `` Age int `default:"30"` }{"Lily", 29} multiconfig.MustLoadWithPath("config.toml", &cfg) fmt.Println(cfg) } config: name = "Tom"`


the result is "{Tom 30}",I expected cfg's Age is 29, I think cfg's Age will be 30 when not initialized

rjeczalik commented 6 years ago

Hey @icoder528! The default tag overwrites any value that the struct field was initialised with. This is by design.