diff options
| author | Francesc Campoy <campoy@golang.org> | 2016-11-07 23:37:21 -0800 |
|---|---|---|
| committer | Francesc Campoy Flores <campoy@golang.org> | 2016-11-10 20:38:11 +0000 |
| commit | 47bdae942242eca4be94989bab485bb1335f354d (patch) | |
| tree | aa30ca983d460ac40a31f8b7b8b3490e648a5205 /src/runtime | |
| parent | 91135f27415ae582081e59d1b70f77d4d4d58112 (diff) | |
| download | go-47bdae942242eca4be94989bab485bb1335f354d.tar.xz | |
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/32911
Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/runtime')
0 files changed, 0 insertions, 0 deletions
