| 1063 | } |
| 1064 | |
| 1065 | func (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 | |
| 1078 | func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) error { |
| 1079 | dataVal := reflect.Indirect(reflect.ValueOf(data)) |