From 07d9c88d899a52f7e0bcece893bea07b165a9a09 Mon Sep 17 00:00:00 2001 From: PratikDhanave Date: Tue, 22 Sep 2026 08:43:02 +0530 Subject: [PATCH] Fix SwitchBuilder.AddCase godoc: no type-T filtering AddCase takes predicate func(msg any) bool with no type parameter; the predicate alone matches the raw message. The doc's "messages of type T" implied a generic type filter that does not exist. --- workflow/builder.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/builder.go b/workflow/builder.go index 613a5141..6bd55cc9 100644 --- a/workflow/builder.go +++ b/workflow/builder.go @@ -616,8 +616,8 @@ func (wb *Builder) AddSwitch(source ExecutorBinding) *SwitchBuilder { } } -// AddCase adds a case branch matching messages of type T satisfying the -// predicate. The matched message is routed to all bindings in targets. +// AddCase adds a case branch matching messages for which the predicate returns +// true. The matched message is routed to all bindings in targets. func (s *SwitchBuilder) AddCase(predicate func(msg any) bool, targets ...ExecutorBinding) *SwitchBuilder { if predicate == nil { panic("workflow: switch case predicate cannot be nil")