cmd/vet: detect defer resp.Body.Close() before error check
This check detects the code resp, err := http.Get("http://foo.com") defer resp.Body.Close() if err != nil { ... } For every call to a function on the net/http package or any method on http.Client that returns (*http.Response, error), it checks whether the next line is a defer statement that calls on the response. Fixes #17780. Change-Id: I9d70edcbfa2bad205bf7f45281597d074c795977 Reviewed-on: https://go-review.googlesource.com/32911Reviewed-by: Rob Pike <r@golang.org>
Showing
src/cmd/vet/httpresponse.go
0 → 100644
Please register or sign in to comment