Skip to content

Commit 5ad4bc0

Browse files
committed
Add decoder opts to unmarshal exact
1 parent bcb420b commit 5ad4bc0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

viper.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -949,9 +949,11 @@ func decode(input interface{}, config *mapstructure.DecoderConfig) error {
949949

950950
// UnmarshalExact unmarshals the config into a Struct, erroring if a field is nonexistent
951951
// in the destination struct.
952-
func UnmarshalExact(rawVal interface{}) error { return v.UnmarshalExact(rawVal) }
953-
func (v *Viper) UnmarshalExact(rawVal interface{}) error {
954-
config := defaultDecoderConfig(rawVal)
952+
func UnmarshalExact(rawVal interface{}, opts ...DecoderConfigOption) error {
953+
return v.UnmarshalExact(rawVal, opts...)
954+
}
955+
func (v *Viper) UnmarshalExact(rawVal interface{}, opts ...DecoderConfigOption) error {
956+
config := defaultDecoderConfig(rawVal, opts...)
955957
config.ErrorUnused = true
956958

957959
err := decode(v.AllSettings(), config)

0 commit comments

Comments
 (0)