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

the key in 'n', 'y' convert to bool #930

Closed
jtsai-dev opened this issue Jun 28, 2020 · 1 comment
Closed

the key in 'n', 'y' convert to bool #930

jtsai-dev opened this issue Jun 28, 2020 · 1 comment
Labels
resolution/duplicate This issue or pull request already exists

Comments

@jtsai-dev
Copy link

hello, i'm using viper to get config from a .yaml file, i have following yaml:

Bloomfilter:
  Name: example
  N: 1000000
  P: 0.001

and the struct:

type bloomfilter struct {
	Name string  `yaml:"Name"`
	N    uint64  `yaml:"Y"`
	P    float64 `yaml:"P"`
}

after unmarshal, i can get all the correct values except N (N is always 0), it looks that would be convert to bool when the key is 'n' or 'y', then bloomfilter.N = 0 as zerovalue?
i am not sure this is a bug or ... feature? so i can not use ‘n’ or 'y' as the key?

@sagikazarmark sagikazarmark added the resolution/duplicate This issue or pull request already exists label Jan 1, 2022
@sagikazarmark
Copy link
Collaborator

Duplicate of #1146

tl;dr quote the keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution/duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants