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:
parent
05b01348d5
commit
273ee45272
1 changed files with 3 additions and 1 deletions
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue