Skip to content

Commit 4c9b2a2

Browse files
scopsagikazarmark
authored andcommitted
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.
1 parent a4a551f commit 4c9b2a2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ One important thing to recognize is that each Get function will return a zero
565565
value if it’s not found. To check if a given key exists, the `IsSet()` method
566566
has been provided.
567567

568+
The zero value will also be returned if the value is set, but fails to parse
569+
as the requested type.
570+
568571
Example:
569572
```go
570573
viper.GetString("logfile") // case-insensitive Setting & Getting

0 commit comments

Comments
 (0)