From 9dc7182b1904842b2a302433fb9b64b3cd52768c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 21 Nov 2023 09:31:45 +0200 Subject: [PATCH] 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. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 78102fb..53e07c6 100644 --- a/README.md +++ b/README.md @@ -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 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