From d8f3b3253e429a0a1c0d0841bb6d75247b21b05a Mon Sep 17 00:00:00 2001 From: Steven Vo <875426+stevenvo@users.noreply.github.com> Date: Thu, 25 Dec 2025 23:40:48 +0700 Subject: [PATCH] Fix StreamCancelFn type definition StreamCancelFn was incorrectly defined as func() but is actually used as func(context.Context) error throughout the codebase. This caused build failures in multiple places: - wshclientutil.go:66: cannot use func(ctx context.Context) error as func() value - web.go:255: cannot use func() as func(context.Context) error value Fixed by correcting the type definition in wshrpctypes.go to match actual usage. Fixes build errors introduced in #2709 --- pkg/wshrpc/wshclient/wshclientutil.go | 4 ++-- pkg/wshrpc/wshrpctypes.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/wshrpc/wshclient/wshclientutil.go b/pkg/wshrpc/wshclient/wshclientutil.go index 52d311c0a..ac8d7e259 100644 --- a/pkg/wshrpc/wshclient/wshclientutil.go +++ b/pkg/wshrpc/wshclient/wshclientutil.go @@ -63,8 +63,8 @@ func sendRpcRequestResponseStreamHelper[T any](w *wshutil.WshRpc, command string rtnErr(respChan, err) return respChan } - opts.StreamCancelFn = func(ctx context.Context) error { - return reqHandler.SendCancel(ctx) + opts.StreamCancelFn = func() { + reqHandler.SendCancel(context.Background()) } go func() { defer func() { diff --git a/pkg/wshrpc/wshrpctypes.go b/pkg/wshrpc/wshrpctypes.go index 14ffb1477..fe8956dfa 100644 --- a/pkg/wshrpc/wshrpctypes.go +++ b/pkg/wshrpc/wshrpctypes.go @@ -373,7 +373,7 @@ type RpcOpts struct { NoResponse bool `json:"noresponse,omitempty"` Route string `json:"route,omitempty"` - StreamCancelFn func() `json:"-"` // this is an *output* parameter, set by the handler + StreamCancelFn func(context.Context) error `json:"-"` // this is an *output* parameter, set by the handler } const (