mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-10-28 02:21:59 +08:00
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:
@@ -291,6 +291,7 @@ func TestCancelableConnClosesUnderlyingTransportWhenCloseRacesCancel(t *testing.
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
if mode == "pre-canceled" {
|
||||
cancel()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user