You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom decoders of structs are called even though the field is not annotated with env tag.
My use case is using go-envconfig to fill in values in a config struct that is already partially filled from other sources.
A minimal example results in an error Time.UnmarshalBinary: no data. This is unexpected behaviour as an error is returned and the original filled value is replaced by the zero value.
type Config struct {
Time time.Time
}
I have seen #64 and #68 and I understand the need for backward compatibility, though they seem to apply to fields with env tags. Would it be possible to skip processing of untagged fields that are structs with custom decoders?
The text was updated successfully, but these errors were encountered:
Hi there - I think #64 is exactly this, which leads to the path of #68 for maintaining backwards-compatibility.
Envconfig always allocates uninitialized fields, even without an env tag. This was an intentional design decision that differs from other env -> struct parsing libraries.
The only thing I think we could do would be to skip processing decoders with noinit, but I think even that would be a breaking API change unfortunately.
It'd be helpful to chime in with specific use cases on #69 to make sure we support them in 1.0+.
Custom decoders of structs are called even though the field is not annotated with
env
tag.My use case is using go-envconfig to fill in values in a config struct that is already partially filled from other sources.
A minimal example results in an error
Time.UnmarshalBinary: no data
. This is unexpected behaviour as an error is returned and the original filled value is replaced by the zero value.I have seen #64 and #68 and I understand the need for backward compatibility, though they seem to apply to fields with
env
tags. Would it be possible to skip processing of untagged fields that are structs with custom decoders?The text was updated successfully, but these errors were encountered: