mirror of
https://github.com/spf13/viper
synced 2025-05-11 06:37:27 +00:00
doc: notic check instance return by viper.Sub
This commit is contained in:
parent
a0285163e1
commit
8a91529b51
1 changed files with 3 additions and 0 deletions
|
@ -653,6 +653,9 @@ cfg2 := viper.Sub("app.cache2")
|
|||
cache2 := NewCache(cfg2)
|
||||
```
|
||||
|
||||
Notice `Sub` will return `nil` when key does not exist.
|
||||
And you should check new viper instance return by `Sub` to avoid invalid memory address error.
|
||||
|
||||
### Unmarshaling
|
||||
|
||||
You also have the option of Unmarshaling all or a specific value to a struct, map,
|
||||
|
|
Loading…
Add table
Reference in a new issue