Improve documentation of Unmarshaling

This commit is contained in:
Wenbin Zhang 2018-10-31 23:25:49 -07:00
parent 62edee3196
commit 649c95a3fa

View file

@ -606,12 +606,14 @@ type config struct {
var C config var C config
err := Unmarshal(&C) err := viper.Unmarshal(&C)
if err != nil { if err != nil {
t.Fatalf("unable to decode into struct, %v", err) t.Fatalf("unable to decode into struct, %v", err)
} }
``` ```
`mapstructure` is the only supported tag.
### Marshalling to string ### Marshalling to string
You may need to marhsal all the settings held in viper into a string rather than write them to a file. You may need to marhsal all the settings held in viper into a string rather than write them to a file.