fix(backend): 修复 golangci-lint 报告的问题
- gofmt: 修复代码格式问题 - errcheck: 处理 WriteString 和 Close 返回值 - staticcheck: 错误信息改为小写开头 - staticcheck: 移除无效的 nil 检查 - staticcheck: 使用 append 替换循环 - staticcheck: 使用无条件的 TrimPrefix - ineffassign: 移除无效赋值 - unused: 移除未使用的 geminiOAuthService 字段 - 重新生成 wire_gen.go
This commit is contained in:
@@ -365,10 +365,6 @@ func (s *GeminiMessagesCompatService) Forward(ctx context.Context, c *gin.Contex
|
||||
return nil, fmt.Errorf("unsupported account type: %s", account.Type)
|
||||
}
|
||||
|
||||
if buildReq == nil {
|
||||
return nil, s.writeClaudeError(c, http.StatusBadGateway, "upstream_error", "Gemini upstream not configured")
|
||||
}
|
||||
|
||||
var resp *http.Response
|
||||
for attempt := 1; attempt <= geminiMaxRetries; attempt++ {
|
||||
upstreamReq, idHeader, err := buildReq(ctx)
|
||||
@@ -1128,7 +1124,6 @@ func (s *GeminiMessagesCompatService) handleStreamingResponse(c *gin.Context, re
|
||||
"index": openToolIndex,
|
||||
})
|
||||
openToolIndex = -1
|
||||
openToolID = ""
|
||||
openToolName = ""
|
||||
seenToolJSON = ""
|
||||
}
|
||||
@@ -2069,7 +2064,7 @@ func extractClaudeContentText(v any) string {
|
||||
}
|
||||
if pm["type"] == "text" {
|
||||
if text, ok := pm["text"].(string); ok {
|
||||
sb.WriteString(text)
|
||||
_, _ = sb.WriteString(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user