engine: resources: Consider passing in funcs if possible

Let this sit in the test resource for now.
This commit is contained in:
James Shubin
2023-08-29 20:35:04 -04:00
parent 0d381e4c91
commit 6c0775ba59
2 changed files with 8 additions and 1 deletions

View File

@@ -86,6 +86,9 @@ type TestRes struct {
AnotherStr string `lang:"anotherstr" yaml:"anotherstr"`
// Func1 passes the value 42 to the input and returns a string.
Func1 func(int) string `lang:"func1" yaml:"func1"`
ValidateBool bool `lang:"validatebool" yaml:"validate_bool"` // set to true to cause a validate error
ValidateError string `lang:"validateerror" yaml:"validate_error"` // set to cause a validate error
AlwaysGroup bool `lang:"alwaysgroup" yaml:"always_group"` // set to true to cause auto grouping
@@ -187,6 +190,10 @@ func (obj *TestRes) CheckApply(ctx context.Context, apply bool) (bool, error) {
obj.init.Logf("%s: AnotherStr: %v", obj, obj.AnotherStr)
if obj.Func1 != nil {
obj.init.Logf("%s: Func1: %v", obj, obj.Func1(42))
}
// send
hello := obj.SendValue
if err := obj.init.Send(&TestSends{

View File

@@ -440,7 +440,7 @@ func Into(v Value, rv reflect.Value) error {
return Into(v.V, rv)
default:
return fmt.Errorf("cannot Into() %+v of type %s into %s", v, v.Type(), typ)
return fmt.Errorf("cannot Into() %+v of type (%T) %s into %s", v, v, v.Type(), typ)
}
}