MCPcopy
hub / github.com/mitchellh/mapstructure / decodeFunc

Method decodeFunc

mapstructure.go:1065–1076  ·  view source on GitHub ↗
(name string, data interface{}, val reflect.Value)

Source from the content-addressed store, hash-verified

1063}
1064
1065func (d *Decoder) decodeFunc(name string, data interface{}, val reflect.Value) error {
1066 // Create an element of the concrete (non pointer) type and decode
1067 // into that. Then set the value of the pointer to this type.
1068 dataVal := reflect.Indirect(reflect.ValueOf(data))
1069 if val.Type() != dataVal.Type() {
1070 return fmt.Errorf(
1071 "'%s' expected type '%s', got unconvertible type '%s', value: '%v'",
1072 name, val.Type(), dataVal.Type(), data)
1073 }
1074 val.Set(dataVal)
1075 return nil
1076}
1077
1078func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) error {
1079 dataVal := reflect.Indirect(reflect.ValueOf(data))

Callers 1

decodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected