engine: util: Remove the ValueOf hack
We've got something in the core utility function now.
This commit is contained in:
@@ -323,17 +323,8 @@ func ResToParamValues(res engine.Res) (map[string]types.Value, error) {
|
|||||||
continue // skip zero values
|
continue // skip zero values
|
||||||
}
|
}
|
||||||
|
|
||||||
// hack to support Value resource
|
// TODO: consider turning this into types.ConfigurableValueOf
|
||||||
// TODO: consider letting types.ValueOf turn an interface into a variant
|
// and allowing the `kind == reflect.Interface` option?
|
||||||
typ := rval.Type()
|
|
||||||
kind := typ.Kind()
|
|
||||||
if kind == reflect.Interface && rval.CanInterface() && !rval.IsNil() {
|
|
||||||
s := fmt.Sprintf("%v", rval) // magic concrete value printer
|
|
||||||
val, _ := types.ValueOfGolang(s)
|
|
||||||
ret[name] = val
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
val, err := types.ValueOf(rval)
|
val, err := types.ValueOf(rval)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// This can happen for bad fields like "Base" and so on.
|
// This can happen for bad fields like "Base" and so on.
|
||||||
|
|||||||
Reference in New Issue
Block a user