go-workflows icon indicating copy to clipboard operation
go-workflows copied to clipboard

When scheduling activities or sub-workflows check if expected return type matches activity/workflow definition

Open cschleiden opened this issue 2 years ago • 0 comments

For a scenario like:

func SubWorkflow(ctx workflow.Context) (int, error) { ... }

func Workflow(ctx workflow.Context) error {
  x, err := workflow.CreateSubWorkflowInstance[string](ctx, ..., SubWorkflow).Get(ctx)
}

it would be good to try to detect that the return type int of SubWorkflow doesn't match the expected string.

Ideally we'd catch that via generics, but I wasn't able to make that work (see https://cschleiden.dev/blog/2022-03-06-go-workflows-generics/) so maybe check it at runtime.

cschleiden avatar Jul 29 '22 16:07 cschleiden