Skip to content

Commit

Permalink
Add global UnmarshalExact method
Browse files Browse the repository at this point in the history
There is no helper method for UnmarshalExact which calls the
corresponding method on the global viper instance.
  • Loading branch information
greghaynes authored and sagikazarmark committed Dec 6, 2019
1 parent 4ad4c8d commit bcb420b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ func decode(input interface{}, config *mapstructure.DecoderConfig) error {

// UnmarshalExact unmarshals the config into a Struct, erroring if a field is nonexistent
// in the destination struct.
func UnmarshalExact(rawVal interface{}) error { return v.UnmarshalExact(rawVal) }
func (v *Viper) UnmarshalExact(rawVal interface{}) error {
config := defaultDecoderConfig(rawVal)
config.ErrorUnused = true
Expand Down

0 comments on commit bcb420b

Please sign in to comment.