mirror of
https://github.com/spf13/viper
synced 2025-05-11 06:37:27 +00:00
Added opts to DecoderConfigOption
This commit is contained in:
parent
62edee3196
commit
c66462282e
1 changed files with 2 additions and 2 deletions
4
viper.go
4
viper.go
|
@ -851,8 +851,8 @@ 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 (v *Viper) UnmarshalExact(rawVal interface{}) error {
|
func (v *Viper) UnmarshalExact(rawVal interface{}, opts ...DecoderConfigOption) error {
|
||||||
config := defaultDecoderConfig(rawVal)
|
config := defaultDecoderConfig(rawVal, opts...)
|
||||||
config.ErrorUnused = true
|
config.ErrorUnused = true
|
||||||
|
|
||||||
err := decode(v.AllSettings(), config)
|
err := decode(v.AllSettings(), config)
|
||||||
|
|
Loading…
Add table
Reference in a new issue