-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessing array slices fails for non-lowercase keys #1386
Comments
👋 Thanks for reporting! A maintainer will take a look at your issue shortly. 👀 In the meantime: We are working on Viper v2 and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues. ⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9 📣 If you've already given us your feedback, you can still help by spreading the news, https://twitter.com/sagikazarmark/status/1306904078967074816 Thank you! ❤️ |
For the record: it looks like this support was originally added in #861, so it's possible something was missed there. |
Due to spf13/viper#1386, array keys with mixed case are not parsed correctly. At least for the time being, mitigate by changing some keys to all lowercase. Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Fixes spf13#1386 Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Due to spf13/viper#1386, array keys with mixed case are not parsed correctly. At least for the time being, mitigate by changing some keys to all lowercase. Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Due to spf13/viper#1386, array keys with mixed case are not parsed correctly. At least for the time being, mitigate by changing some keys to all lowercase. Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Fixes spf13#1386 Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Fixes #1386 Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Preflight Checklist
Viper Version
master
Go Version
1.17.9
Config Source
Files
Format
YAML
Repl.it link
No response
Code reproducing the issue
Expected Behavior
If my config contains an array, and one of the sub-keys in that array is non-lowercase (ie contains one or more capital letters), Viper is unable to retrieve the key using slice notation.
I modified a simple unit test to contain this array element:
When accessing the value with
v.GetString("tv.0.originalNetwork")
, I expect to receive the value "syfy".Actual Behavior
An empty string is returned.
Steps To Reproduce
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: