Fix golangci-lint errcheck and unused errors
CI / test (push) Failing after 12m57s

- manager.go: add _ = to syscall.Kill and proc.Signal calls (6 fixes)
- chat.go: add _ = to c.Writer.WriteString calls (9 fixes)
- webhook.go: remove unused webhookSecret field
This commit is contained in:
2026-07-30 17:20:34 -04:00
parent e9c81f7c30
commit f775c2f67e
3 changed files with 17 additions and 18 deletions
+9 -9
View File
@@ -180,19 +180,19 @@ func (h *ChatHandler) handleStream(c *gin.Context, apiKey *db.ApiKey, req ChatCo
completionTokens += len(resp.Choices[0].Delta.Content) / 4
// Write SSE
c.Writer.WriteString("data: ")
c.Writer.WriteString("{\"id\":\"chatcmpl-1\",\"object\":\"chat.completion.chunk\",\"created\":")
c.Writer.WriteString(formatInt(resp.Created))
c.Writer.WriteString(",\"model\":\"")
c.Writer.WriteString(resp.Model)
c.Writer.WriteString("\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"")
c.Writer.WriteString(escapeJSON(resp.Choices[0].Delta.Content))
c.Writer.WriteString("\"}}]}\n\n")
_, _ = c.Writer.WriteString("data: ")
_, _ = c.Writer.WriteString("{\"id\":\"chatcmpl-1\",\"object\":\"chat.completion.chunk\",\"created\":")
_, _ = c.Writer.WriteString(formatInt(resp.Created))
_, _ = c.Writer.WriteString(",\"model\":\"")
_, _ = c.Writer.WriteString(resp.Model)
_, _ = c.Writer.WriteString("\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"")
_, _ = c.Writer.WriteString(escapeJSON(resp.Choices[0].Delta.Content))
_, _ = c.Writer.WriteString("\"}}]}\n\n")
flusher.Flush()
case err := <-errCh:
h.logUsage(c, apiKey, req.Model, promptTokens, completionTokens, totalTokens, "error", start)
c.Writer.WriteString("data: [DONE]\n\n")
_, _ = c.Writer.WriteString("data: [DONE]\n\n")
flusher.Flush()
if err != nil {
slog.Error("stream error", "error", err)
+6 -6
View File
@@ -92,14 +92,14 @@ func (m *Manager) Stop() {
pgid, err := syscall.Getpgid(m.proc.Process.Pid)
if err == nil {
syscall.Kill(-pgid, syscall.SIGTERM)
_ = syscall.Kill(-pgid, syscall.SIGTERM)
} else {
m.proc.Process.Signal(syscall.SIGTERM)
_ = m.proc.Process.Signal(syscall.SIGTERM)
}
<-ctx.Done()
if m.proc.ProcessState == nil {
syscall.Kill(-pgid, syscall.SIGKILL)
_ = syscall.Kill(-pgid, syscall.SIGKILL)
}
}
@@ -256,9 +256,9 @@ func (m *Manager) terminateProcess() {
pgid, err := syscall.Getpgid(m.proc.Process.Pid)
if err == nil {
syscall.Kill(-pgid, syscall.SIGTERM)
_ = syscall.Kill(-pgid, syscall.SIGTERM)
} else {
m.proc.Process.Signal(syscall.SIGTERM)
_ = m.proc.Process.Signal(syscall.SIGTERM)
}
done := make(chan error, 1)
@@ -269,7 +269,7 @@ func (m *Manager) terminateProcess() {
select {
case <-ctx.Done():
if pgid, err := syscall.Getpgid(m.proc.Process.Pid); err == nil {
syscall.Kill(-pgid, syscall.SIGKILL)
_ = syscall.Kill(-pgid, syscall.SIGKILL)
}
case <-done:
}
-1
View File
@@ -32,7 +32,6 @@ type WebhookPayload struct {
type WebhookService struct {
db *gorm.DB
client *http.Client
webhookSecret string
}
func NewWebhookService(db *gorm.DB) *WebhookService {