Skip to content

Commit

Permalink
Note Get* behavior on parse failure
Browse files Browse the repository at this point in the history
Even though it's kind of evident as these functions don't return an
error, it can still come as a surprise.
  • Loading branch information
scop authored and sagikazarmark committed Nov 30, 2023
1 parent a4a551f commit 4c9b2a2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,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
has been provided.

The zero value will also be returned if the value is set, but fails to parse
as the requested type.

Example:
```go
viper.GetString("logfile") // case-insensitive Setting & Getting
Expand Down

0 comments on commit 4c9b2a2

Please sign in to comment.