Close response bodies

MEDIUM1.0.0
When to apply When making HTTP requests in Go.

Rule

Close every HTTP response body with defer resp.Body.Close() right after checking the error.

Evidence

Each successful request is followed by a deferred close of its body.