Add global UnmarshalExact method

There is no helper method for UnmarshalExact which calls the
corresponding method on the global viper instance.
This commit is contained in:
Gregory Haynes 2018-06-08 20:32:49 +00:00 committed by Márk Sági-Kazár
parent 4ad4c8df70
commit bcb420b705
1 changed files with 1 additions and 0 deletions

View File

@ -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 // UnmarshalExact unmarshals the config into a Struct, erroring if a field is nonexistent
// in the destination struct. // in the destination struct.
func UnmarshalExact(rawVal interface{}) error { return v.UnmarshalExact(rawVal) }
func (v *Viper) UnmarshalExact(rawVal interface{}) error { func (v *Viper) UnmarshalExact(rawVal interface{}) error {
config := defaultDecoderConfig(rawVal) config := defaultDecoderConfig(rawVal)
config.ErrorUnused = true config.ErrorUnused = true