mirror of
https://github.com/spf13/viper
synced 2025-05-07 20:57:18 +00:00
Improve documentation of Unmarshaling
This commit is contained in:
parent
62edee3196
commit
649c95a3fa
1 changed files with 3 additions and 1 deletions
|
@ -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.
|
||||||
|
|
Loading…
Add table
Reference in a new issue