Pretty self-explanatory. There is an open issue about this in Cadence Go SDK as well (and a PR that fell through).
I believe the recommendation is to have an interface as follows (similar to the Java SDK, but with ctx
to pass the saga):
sagaCtx := saga.New(ctx, options)
...
saga.addCompensation(sagaCtx, ....)
...
saga.Compensate(sagaCtx)
And utilising Workflow.NewDisconnectedContext
behind the scenes to ensure the compensation code continues to execute even after the root context has been cancelled.