You can already achieve this with the current API, but it requires an additional goroutine to transmit cancellation of ctx to the interpreter, something like this:
Perhaps we could make this simpler by adding a convenience function to the API, or maybe all it needs is an executable example of cancellation in action.
You can already achieve this with the current API, but it requires an additional goroutine to transmit cancellation of ctx to the interpreter, something like this:
Perhaps we could make this simpler by adding a convenience function to the API, or maybe all it needs is an executable example of cancellation in action.
If you pass the context in the thread using Thread.SetLocal, then long-running built-in functions can retrieve it and honor cancellation too; see https://github.com/google/starlark-go/issues/252#issuecomment-553930328.
See also: