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

Overwrite and default logic does not work with bool pointer #71

Closed
capri-xiyue opened this issue Aug 5, 2022 · 1 comment
Closed

Overwrite and default logic does not work with bool pointer #71

capri-xiyue opened this issue Aug 5, 2022 · 1 comment

Comments

@capri-xiyue
Copy link

capri-xiyue commented Aug 5, 2022

{
			name: "bool_pointer_overwrite_default",
			input: &struct {
				Field *bool `env:"FIELD,noinit,overwrite,default=true"`
			}{
				Field: new(bool),
			},
			exp: &struct {
				Field *bool `env:"FIELD,noinit,overwrite,default=true"`
			}{
				Field: new(bool),
			},
			lookuper: MapLookuper(nil),
		},

I wrote test cases as above and it failed.
It does not follow the logic listed in https://github.com/sethvargo/go-envconfig#overwrite
If the struct field has a non-zero value and a default is set and if no environment variable is specified, the struct field's existing value will be used (the default is ignored).

@sethvargo
Copy link
Owner

Fixed in #73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants