fix(lint): check fmt.Fprintf errors in webhook handler (infra#190)
errcheck flagged two unchecked fmt.Fprintf return values in internal/webhook/webhook.go, failing CI (run 310/311) for the whole 'trigger brain-sync on Gitea push' feature -- so no new ingestion image was ever built, and the deployed image predates this feature entirely even though infra's manifest (secret, RBAC, env wiring) was already live. Both writes are best-effort informational text after WriteHeader has already committed the status code -- a failed write here only happens on client disconnect and nothing depends on it succeeding, so explicitly discard (_, _ =) rather than log-and-continue noise. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -94,7 +94,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if ev.Repo.FullName != h.WatchRepo || ev.Ref != "refs/heads/main" {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
fmt.Fprintf(w, "ignored: repo=%s ref=%s", ev.Repo.FullName, ev.Ref)
|
||||
_, _ = fmt.Fprintf(w, "ignored: repo=%s ref=%s", ev.Repo.FullName, ev.Ref)
|
||||
return
|
||||
}
|
||||
jobName, err := TriggerJobFromCronJob(r.Context(), h.Clientset, h.Namespace, h.CronJobName)
|
||||
@@ -105,5 +105,5 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
h.Logger.Info("webhook: triggered brain-sync job", "job", jobName)
|
||||
w.WriteHeader(http.StatusOK)
|
||||
fmt.Fprintf(w, "triggered %s", jobName)
|
||||
_, _ = fmt.Fprintf(w, "triggered %s", jobName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user