-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Connecting a StringToString parameter with viper does not seem work. #778
Comments
No one? |
|
This issue is being marked as stale due to a long period of inactivity |
UPD. wiped my initial text. TLDR: I kinda got the same problem, but actually I was passing arguments the wrong way. |
So the underlying issue was fixed? Going to go ahead and close but feel free to reopen if I misinterpreted. |
Hi.
I am trying to connect a
map[string]string
parameter to Viper and it does not seem to work.In my
init
function I doand then in the
cmd
function I doThe problem seems to be that what is "saved" in Cobra for the value
headers
is something of the typeStringToString
and notmap[string]string
as I would have thought.(that is the value of the type I get if I do
cmd.Flag("headers").Value.Type()
If I save my parameter value by directly specifying the map like this:
It correctly saves the value in the map. But then I would have to check that the map is not empty and if it is save the value from viper in the map.
I don't know If this is a bug or If I am missing something?
Thanks!
The text was updated successfully, but these errors were encountered: