Skip to content

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

@capri-xiyue

Description

@capri-xiyue
{
			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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions