Releases: sethvargo/go-envconfig
v0.8.0
What's Changed
The previous implementation of overwrite
would always overwrite values in the given struct, even if values existed. While this is the definition of overwrite
, it unintentionally extended to default
values as well. So even if a value was explicitly set on a struct, it would be overwritten with the "default" value set in envconfig. This was an unexpected behavior, since defaults should take the lowest precedence.
The new implementation has the following behavior with overwrite
:
-
If the struct field has the zero value and a default is set:
-
If no environment variable is specified, the struct field will be populated with the default value.
-
If an environment variable is specified, the struct field will be populate with the environment variable value.
-
-
If the struct field has a non-zero value and a default is set:
-
If no environment variable is specified, the struct field's existing value will be used (the default is ignored).
-
If an environment variable is specified, the struct field's existing value will be overwritten with the environment variable value.
-
As part of this change, decoder interfaces are only processed when an environment (or a default) is present.
Full Changelog: v0.7.0...v0.8.0
v0.7.0
What's Changed
-
Change custom unmarshaling order by @gust1n in #59. This changes the order of resolution for unmarshalling to:
envconfig.Decoder
encoding.TextUnmarshaler
json.Unmarshaler
encoding.BinaryUnmarshaler
gob.GobDecoder
New Contributors
Full Changelog: v0.6.2...v0.7.0
v0.6.2
What's Changed
- Fixing struct pointer initialization with no values set by @williamgcampbell in #57
New Contributors
- @williamgcampbell made their first contribution in #57
Full Changelog: v0.6.1...v0.6.2
v0.6.1
What's Changed
- Sort struct fields for reduce memory by @zchee in #51
- Fix GitHub Actions badge url and query by @zchee in #52
- Fix typo in README.md by @ucpr in #53
- Extend
noinit
to all pointer fields by @sethvargo in #55
New Contributors
Full Changelog: v0.6.0...v0.6.1