Not sure if this is the correct place to ask.
This is my code:
package main
import (
"fmt"
"log"
"github.com/1set/starlight"
)
type T func(string) string
func A(in string) string {
return "Hello " + in
}
func B(m T) {
fmt.Println(m("World"))
}
var src = `B(A)`
func dothings() error {
globals := map[string]interface{}{
"A": A,
"B": B,
}
_, err := starlight.Eval([]byte(src), globals, nil)
return err
}
func main() {
if err := dothings(); err != nil {
log.Fatal(err)
}
}
The result I get is:
2025/04/06 19:50:43 arg 0: expected type main.T got *starlark.Builtin
exit status 1
What would be a strategy to get this working? In my real application, I cannot change the signature of function B (I can write a wrapper around it).
Not sure if this is the correct place to ask.
This is my code:
The result I get is:
What would be a strategy to get this working? In my real application, I cannot change the signature of function B (I can write a wrapper around it).