From 34d4e334a814d95ad363c25a78907812f4417b5f Mon Sep 17 00:00:00 2001 From: Krisztian Litkey Date: Mon, 9 Dec 2024 17:33:24 +0200 Subject: [PATCH] healthz: golangci-lint fixes. Signed-off-by: Krisztian Litkey --- pkg/healthz/healthz.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/healthz/healthz.go b/pkg/healthz/healthz.go index 0cd1657ca..34373d941 100644 --- a/pkg/healthz/healthz.go +++ b/pkg/healthz/healthz.go @@ -54,14 +54,20 @@ func serve(w http.ResponseWriter, req *http.Request) { status, details := check() if status == Healthy { w.WriteHeader(200) - w.Write([]byte("ok")) + _, err := w.Write([]byte("ok")) + if err != nil { + log.Errorf("failed to write response: %v", err) + } } else { errors := "" for _, err := range details { errors += fmt.Sprintf("%v\n", err) } w.WriteHeader(500) - w.Write([]byte(errors)) + _, err := w.Write([]byte(errors)) + if err != nil { + log.Errorf("failed to write response: %v", err) + } } }