Skip to content

StringToString pflag values are not handled correctly by viper #608

@terev

Description

@terev

I bind a StringToString pflag like so

RootCmd.PersistentFlags().StringToStringP(key, conf.alias, defaultValue, conf.usage)
viper.BindPFlag(key, RootCmd.PersistentFlags().Lookup(key))

Then retrieve the value from my viper with

smap := viper.GetStringMapString(key)

The string map returned is an empty map, which seems to be the default value returned on error by spf13/cast.

I expected to get a populated string map back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions