From 7105e38544adf20eaa8d7fb680d241067e7b809b Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sat, 18 Nov 2023 13:45:26 -0500 Subject: [PATCH] engine: util: Remove the ValueOf hack We've got something in the core utility function now. --- engine/util/util.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/engine/util/util.go b/engine/util/util.go index 17489efb..501318e2 100644 --- a/engine/util/util.go +++ b/engine/util/util.go @@ -323,17 +323,8 @@ func ResToParamValues(res engine.Res) (map[string]types.Value, error) { continue // skip zero values } - // hack to support Value resource - // TODO: consider letting types.ValueOf turn an interface into a variant - 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 - } - + // TODO: consider turning this into types.ConfigurableValueOf + // and allowing the `kind == reflect.Interface` option? val, err := types.ValueOf(rval) if err != nil { // This can happen for bad fields like "Base" and so on.