MCPcopy
hub / github.com/spf13/viper / decode

Function decode

viper.go:1025–1031  ·  view source on GitHub ↗

decode is a wrapper around mapstructure.Decode that mimics the WeakDecode functionality.

(input any, config *mapstructure.DecoderConfig)

Source from the content-addressed store, hash-verified

1023
1024// decode is a wrapper around mapstructure.Decode that mimics the WeakDecode functionality.
1025func decode(input any, config *mapstructure.DecoderConfig) error {
1026 decoder, err := mapstructure.NewDecoder(config)
1027 if err != nil {
1028 return err
1029 }
1030 return decoder.Decode(input)
1031}
1032
1033// UnmarshalExact unmarshals the config into a Struct, erroring if a field is nonexistent
1034// in the destination struct.

Callers 4

UnmarshalKeyMethod · 0.85
UnmarshalMethod · 0.85
decodeStructKeysMethod · 0.85
UnmarshalExactMethod · 0.85

Calls 1

DecodeMethod · 0.95

Tested by

no test coverage detected