Skip to content

Releases: sethvargo/go-envconfig

v0.8.0

14 Jul 02:15
v0.8.0
1a03b30
Compare
Choose a tag to compare

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

09 Jun 13:46
v0.7.0
39c9bc7
Compare
Choose a tag to compare

What's Changed

  • Change custom unmarshaling order by @gust1n in #59. This changes the order of resolution for unmarshalling to:

    1. envconfig.Decoder
    2. encoding.TextUnmarshaler
    3. json.Unmarshaler
    4. encoding.BinaryUnmarshaler
    5. gob.GobDecoder

New Contributors

Full Changelog: v0.6.2...v0.7.0

v0.6.2

31 May 13:46
v0.6.2
befaf9a
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.6.1...v0.6.2

v0.6.1

31 May 13:45
v0.6.1
e94cab6
Compare
Choose a tag to compare

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

  • @zchee made their first contribution in #51
  • @ucpr made their first contribution in #53

Full Changelog: v0.6.0...v0.6.1

v0.6.0

06 Apr 14:01
76d89c2
Compare
Choose a tag to compare

Features

  • Add support for custom element delimiters for slices and maps
  • Add support for custom key/value separators for maps