close the healthz probe body eagerly, errcheck fix

The probe reads nothing from the body, so close-and-check beats an
unchecked defer (which golangci-lint rejects).
This commit is contained in:
Justin Visser 2026-06-11 15:05:05 +02:00
parent 05b01348d5
commit 273ee45272

View file

@ -77,7 +77,9 @@ func probeHealthz(addr string) error {
if err != nil { if err != nil {
return err return err
} }
defer response.Body.Close() if err := response.Body.Close(); err != nil {
return err
}
if response.StatusCode >= 400 { if response.StatusCode >= 400 {
return fmt.Errorf("healthz answered %s", response.Status) return fmt.Errorf("healthz answered %s", response.Status)
} }