mirror of
https://github.com/spf13/viper
synced 2025-05-06 20:27:17 +00:00
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:
parent
15738813a0
commit
f4646eef68
1 changed files with 1 additions and 0 deletions
1
viper.go
1
viper.go
|
@ -798,6 +798,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
|
||||
|
|
Loading…
Add table
Reference in a new issue