fix(lint): resolve go vet lostcancel and static analysis warnings from v8.0.42

- Defer context cancellation in TestCancelableConnClosesUnderlyingTransportWhenCloseRacesCancel to satisfy go vet lostcancel across all control flow paths.
- Remove the unused streamBridgeStream.close wrapper left behind after the closeWithError refactor in internal/pluginhost.
- Annotate shared "gin" string context keys in TestIssue6825SDKCallerReplayIsolation with nolint:staticcheck directives.

Closes: #6953
This commit is contained in:
Luis Pater
2026-10-25 02:10:05 +08:00
parent bc0643405a
commit 2bb6ac6faa
3 changed files with 3 additions and 6 deletions

View File

@@ -291,6 +291,7 @@ func TestCancelableConnClosesUnderlyingTransportWhenCloseRacesCancel(t *testing.
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if mode == "pre-canceled" {
cancel()
}

View File

@@ -194,10 +194,6 @@ func (s *streamBridgeStream) emit(ctx context.Context, chunk pluginapi.ExecutorS
return <-request.done
}
func (s *streamBridgeStream) close(errorMessage string) {
s.closeWithError(rpcStreamError(errorMessage, nil))
}
func (s *streamBridgeStream) closeWithError(err error) {
if s == nil {
return

View File

@@ -396,10 +396,10 @@ func TestIssue6825SDKCallerReplayIsolation(t *testing.T) {
gin.SetMode(gin.TestMode)
ginCtxA, _ := gin.CreateTestContext(httptest.NewRecorder())
ginCtxA.Set("userApiKey", "downstream-api-key-A")
ctxA = context.WithValue(context.Background(), "gin", ginCtxA)
ctxA = context.WithValue(context.Background(), "gin", ginCtxA) //nolint:staticcheck -- "gin" is the shared Gin context key contract.
ginCtxB, _ := gin.CreateTestContext(httptest.NewRecorder())
ginCtxB.Set("userApiKey", "downstream-api-key-B")
ctxB = context.WithValue(context.Background(), "gin", ginCtxB)
ctxB = context.WithValue(context.Background(), "gin", ginCtxB) //nolint:staticcheck -- "gin" is the shared Gin context key contract.
}
assistantA, _ := conversation.callWithContext(ctxA, []byte(issue6825FirstRequest), optsA, scenario.enrich, metadataA)
assistantB, _ := conversation.callWithContext(ctxB, []byte(issue6825FirstRequest), optsB, scenario.enrich, metadataB)