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

Unmarshal doesn't behave correctly for bound pflags #141

Closed
backerman opened this issue Dec 7, 2015 · 1 comment
Closed

Unmarshal doesn't behave correctly for bound pflags #141

backerman opened this issue Dec 7, 2015 · 1 comment
Labels
kind/bug Something isn't working

Comments

@backerman
Copy link

viper.Unmarshal will only unmarshal from bound pflags if viper.SetDefault has been called for the flag.

Example: https://gist.github.com/backerman/6c75b18c90f132d818bf

Output of example when passing --Foo=true:

foo unmarshals as: false
foo is looked up as: true
foo is actually: true
foo now unmarshals as: true
@spf13 spf13 added the kind/bug Something isn't working label Dec 16, 2015
awfm9 pushed a commit that referenced this issue Oct 8, 2016
Fixes #71, #93, #158, #168, #209, #141, #160, #162, #190

* Fixed: indentation in comment
* Fixed: Get() returns nil when nested element not found
* Fixed: insensitiviseMaps() made recursive so that nested keys are lowercased
* Fixed: order of expected<=>actual in assert.Equal() statements
* Fixed: find() looks into "overrides" first
* Fixed: TestBindPFlags() to use a new Viper instance
* Fixed: removed extra aliases from display in Debug()
* Added: test for checking precedence of dot-containing keys.
* Fixed: Set() and SetDefault() insert nested values
* Added: tests for overriding nested values
* Changed: AllKeys() includes all keys / AllSettings() includes overridden nested values
* Added: test for shadowed nested key
* Fixed: properties parsing generates nested maps
* Fixed: Get() and IsSet() work correctly on nested values
* Changed: modifier README.md to reflect changes
@awfm9
Copy link

awfm9 commented Oct 8, 2016

Fixed by #195

@awfm9 awfm9 closed this as completed Oct 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants