Skip to content
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

GetXxx() becomes case-sensitive if called on viper.Sub()? #234

Open
ignstv opened this issue Aug 30, 2016 · 0 comments
Open

GetXxx() becomes case-sensitive if called on viper.Sub()? #234

ignstv opened this issue Aug 30, 2016 · 0 comments

Comments

@ignstv
Copy link

ignstv commented Aug 30, 2016

For example, I have a YAML configuration file like this:

Server:
   Host: "localhost:8080"

If I read this setting with this:

host := viper.GetString("Server.Host")

host contains the intended value, but if I read it with this code:

host := viper.Sub("Server").GetString("Host")

host is empty.
Further debugging reveals that with Sub(), viper seems to store the configuration with exact case ("Host"), but on GetString(), the query key is lowercased and the comparison "Host" == "host" fails.
According to the doc, I thought viper was case-insensitive, so maybe this is a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant