Skip to content

Should RegisterAlias work with BindPFlags? #1598

Closed Answered by wz2b
wz2b asked this question in Q&A
Discussion options

You must be logged in to vote

I think I figured out how I'm supposed to do this. What I did was added a manual binding like this:

viper.BindPFlag("washnetdb.dsn", pflag.Lookup("dsn"))

I am not sure if I'm reading this correctly but it looks like the alias mechanism is only when you're looking things up for example using viper.GetString() ... in other words the aliases are applied at read time, not write time.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by wz2b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant