destStruct must be a pointer to a struct
(val interface{}, destStruct interface{})
| 1170 | |
| 1171 | // destStruct must be a pointer to a struct |
| 1172 | func setFirstField(val interface{}, destStruct interface{}) error { |
| 1173 | v := reflect.ValueOf(destStruct).Elem().FieldByIndex([]int{0}) |
| 1174 | if !v.IsValid() || !v.CanSet() { |
| 1175 | debug.Ppg(val) |
| 1176 | debug.Ppg(destStruct) |
| 1177 | return errors.Wrap(ErrorCannotSetStructField(), "first field") |
| 1178 | } |
| 1179 | v.Set(reflect.ValueOf(val)) |
| 1180 | return nil |
| 1181 | } |
| 1182 | |
| 1183 | // destStruct must be a pointer to a struct |
| 1184 | func setFieldNil(destStruct interface{}, fieldName string) error { |
nothing calls this directly
no test coverage detected