We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some toy code that reproduces this:
package main import ( "fmt" "github.com/starlight-go/starlight" ) func main() { env := map[string]interface{}{"my_callout": my_callout} _, err := starlight.Eval([]byte(` my_callout("Hello World!") # this is fine my_callout(True) # this panics `), env, nil) if err != nil { fmt.Println("Error executing starlight script", err) return } } func my_callout(s string) { fmt.Println("my_callout:", s) }
results in:
my_callout: Hello World! panic: reflect.Value.Convert: value of type bool cannot be converted to type string goroutine 1 [running]: reflect.Value.Convert(0x58c060, 0x725cc1, 0x81, 0x608620, 0x58dde0, 0x1, 0x0, 0x0) C:/Go/src/reflect/value.go:2351 +0x22b vendor/github.com/starlight-go/starlight/convert.makeStarFn.func1(0xc000076a20, 0xc0000769f0, 0xc000050390, 0x1, 0x1, 0x0, 0x0, 0x0, 0x50, 0x5b4540, ...) vendor/github.com/starlight-go/starlight/convert/conv.go:294 +0x469 vendor/go.starlark.net/starlark.(*Builtin).CallInternal(0xc0000769f0, 0xc000076a20, 0xc000050390, 0x1, 0x1, 0x0, 0x0, 0x0, 0x606600, 0x725cc0, ...) vendor/go.starlark.net/starlark/value.go:585 +0x92 vendor/go.starlark.net/starlark.Call(0xc000076a20, 0x606400, 0xc0000769f0, 0xc000050390, 0x1, 0x1, 0x0, 0x0, 0x0, 0x606600, ...) vendor/go.starlark.net/starlark/eval.go:910 +0x142 vendor/go.starlark.net/starlark.call(0xc000076a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000aa000, 0xc000087a9c, 0xc000087bb0, ...) vendor/go.starlark.net/starlark/interp.go:292 +0x4121 vendor/go.starlark.net/starlark.(*Function).CallInternal(0xc0000aa000, 0xc000076a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5b7060, 0xc0000aa000, ...) vendor/go.starlark.net/starlark/interp.go:39 +0x1c8 vendor/go.starlark.net/starlark.Call(0xc000076a20, 0x606480, 0xc0000aa000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) vendor/go.starlark.net/starlark/eval.go:910 +0x142 vendor/go.starlark.net/starlark.(*Program).Init(0xc00008a020, 0xc000076a20, 0xc0000769c0, 0xc00005a460, 0xc000050220, 0xc0000a2060) vendor/go.starlark.net/starlark/eval.go:314 +0xa1 vendor/go.starlark.net/starlark.ExecFile(0xc000076a20, 0x5c952d, 0x8, 0x58b8a0, 0xc00005a460, 0xc0000769c0, 0x20, 0x598900, 0x30001) vendor/go.starlark.net/starlark/eval.go:258 +0xf4 vendor/github.com/starlight-go/starlight.Eval(0x58b8a0, 0xc00005a460, 0xc000087e48, 0x0, 0xc000087f00, 0x40b643, 0xc00005c410) vendor/github.com/starlight-go/starlight/starlight.go:41 +0x161 main.main() starlight-panic/main.go:11 +0x16f
I suspect this is easily fixed by checking !val.Type().ConvertibleTo(argT) and returning error if it's not convertible
The text was updated successfully, but these errors were encountered:
same applies for makeVariadicStarFn
Sorry, something went wrong.
Have opened a PR - #16
Merge pull request starlight-go#15 from awans/exec
9ecd10e
Code cleanup
No branches or pull requests
Some toy code that reproduces this:
results in:
I suspect this is easily fixed by checking !val.Type().ConvertibleTo(argT) and returning error if it's not convertible
The text was updated successfully, but these errors were encountered: