mirror of
https://github.com/spf13/viper
synced 2025-05-07 20:57:18 +00:00
Note Get* behavior on parse failure
Even though it's kind of evident as these functions don't return an error, it can still come as a surprise.
This commit is contained in:
parent
b5daec6e7b
commit
9dc7182b19
1 changed files with 3 additions and 0 deletions
|
@ -563,6 +563,9 @@ One important thing to recognize is that each Get function will return a zero
|
||||||
value if it’s not found. To check if a given key exists, the `IsSet()` method
|
value if it’s not found. To check if a given key exists, the `IsSet()` method
|
||||||
has been provided.
|
has been provided.
|
||||||
|
|
||||||
|
The zero value will also be returned if the value is set, but fails to parse
|
||||||
|
as the requested type.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```go
|
```go
|
||||||
viper.GetString("logfile") // case-insensitive Setting & Getting
|
viper.GetString("logfile") // case-insensitive Setting & Getting
|
||||||
|
|
Loading…
Add table
Reference in a new issue