Releases: sethvargo/go-envconfig
v1.1.0
What's Changed
- Add MustProcess which panics on errors by @sethvargo in #115
Full Changelog: v1.0.3...v1.1.0
v1.0.3
v1.0.2
What's Changed
- Fix docs by @ucpr in #105
- Fix README example code comment by @katsuharu in #106
- Handle case where user accidentally uses Process() with a Config when… by @pdewilde in #109
- Fix docs by @sethvargo in #110
New Contributors
- @katsuharu made their first contribution in #106
- @pdewilde made their first contribution in #109
Full Changelog: v1.0.1...v1.0.2
v1.0.1
v1.0.0
Caution
This release includes breaking changes. Please read these release notes thoroughly.
New features
-
Introduce global and cascading configuration options by @sethvargo in #97
This introduces the concept of global configurations and cascades struct-level configuration options onto all child fields. For example, marking a struct as required will mark all child fields as required. Similarly, setting a custom delimiter on a struct tag propagates that delimiter to all child fields of the struct. This behavior previously only applied to the
noinit
tag, but it now applies to all tags.
Breaking changes
-
Change
MutatorFunc
to be more flexible by @sethvargo in #92 and #94⚠️ BREAKING! This changes the signature of theMutatorFunc
to have more information about prior states. It will include the original environment variable names and values, as well as the currently resolved values. Additionally, the mutation chain can now be stopped without returning an error. -
Require Go 1.21 or later by @sethvargo in #93
⚠️ BREAKING! The new minimum required Go version is 1.21. -
Drop
ExtractDefaults
functionality by @sethvargo in #95⚠️ BREAKING! This removes theExtractDefaults
function. It was rarely used and resulted in extraneous processing. Users who depended on this functionality can callProcessWith
an emptyMapLookuper
(which is allExtractDefaults
did anyway). -
Ignore prefix computing environment variable defaults by @sethvargo in #99
⚠️ BREAKING! Computing the default value for an environment variable when the default value is another environment variable will ignore any prefixes on the current lookuper. See #85 for more information. -
Allow configurable decoding by @sethvargo in #100
⚠️ BREAKING! Envconfig no longer runs decoders or mutators on unset values. To restore the old behavior, add thedecodeunset
struct field annotation or pass theDefaultDecodeUnset
configuration option as true. See #100 for more information.
Full Changelog: v0.9.0...v1.0.0-beta1
v1.0.0-beta1
This is now released as v1.0.0. There are no changes between v1.0.0 and this release.
v0.9.0
What's Changed
- Allow noinit to apply to slices, maps, and unsafe pointers by @sethvargo in #83
Full Changelog: v0.8.3...v0.9.0
v0.8.2
What's Changed
- Track pointer initialization for zero values by @sethvargo in #73
- Drop regexp for performance by @sethvargo in #74
Full Changelog: v0.8.1...v0.8.2
v0.8.1
What's Changed
- Propagate
noinit
from parent fields by @sethvargo in #67 - Always call decoders by @sethvargo in #68
Full Changelog: v0.8.0...v0.8.1
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