Skip to content

Support fmt.Stringer in ExecuteActivity #2049

@LukaGiorgadze

Description

@LukaGiorgadze

PR: #2050

Support fmt.Stringer in getFunctionName

Description

Currently, getFunctionName only supports raw strings or function pointers.
If a caller passes a custom type that implements fmt.Stringer (e.g. a named type alias), it is treated as a function and causes error and hard to get the idea why:

INF log/with_logger.go:45 Task processing failed with error Namespace=default TaskQueue=chat-agent WorkerID=28030@Lukas-MacBook-Pro-M4.local@ WorkerType=WorkflowWorker Error="BadScheduleActivityAttributes: ActivityType is not set on ScheduleActivityTaskCommand. ActivityID=15"

Example

type ActivityName string

func (a ActivityName) String() string {
	return string(a)
}

var agentPlannerActivity ActivityName = "AgentPlannerActivity"

fut := workflow.ExecuteActivity(ctx, agentPlannerActivity, inputs{})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions