Discriminate between mode empty and invalid (#1410)

This commit is contained in:
andig 2021-08-22 20:03:55 +02:00 • committed by GitHub
parent 77552ad722
commit 8834e26adf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 27 deletions

View file

@ -10,7 +10,10 @@ func DecodeOther(other interface{}, cc interface{}) error {
Result: cc,
ErrorUnused: true,
WeaklyTypedInput: true,
DecodeHook: mapstructure.StringToTimeDurationHookFunc(),
DecodeHook: mapstructure.ComposeDecodeHookFunc(
mapstructure.StringToTimeDurationHookFunc(),
mapstructure.TextUnmarshallerHookFunc(),
),
}
decoder, err := mapstructure.NewDecoder(decoderConfig)