mirror of
https://github.com/spf13/viper
synced 2024-12-23 03:57:01 +00:00
Add decoder opts to unmarshal exact
This commit is contained in:
parent
bcb420b705
commit
5ad4bc05cf
1 changed files with 5 additions and 3 deletions
8
viper.go
8
viper.go
|
@ -949,9 +949,11 @@ 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 UnmarshalExact(rawVal interface{}, opts ...DecoderConfigOption) error {
|
||||||
func (v *Viper) UnmarshalExact(rawVal interface{}) error {
|
return v.UnmarshalExact(rawVal, opts...)
|
||||||
config := defaultDecoderConfig(rawVal)
|
}
|
||||||
|
func (v *Viper) UnmarshalExact(rawVal interface{}, opts ...DecoderConfigOption) error {
|
||||||
|
config := defaultDecoderConfig(rawVal, opts...)
|
||||||
config.ErrorUnused = true
|
config.ErrorUnused = true
|
||||||
|
|
||||||
err := decode(v.AllSettings(), config)
|
err := decode(v.AllSettings(), config)
|
||||||
|
|
Loading…
Reference in a new issue