errcheck intentionally warns on defer
statements, but sadly a lot of idiomatic code uses un-checked defer
calls, e.g.
resp, err := httpClient.PostForm(ts.URL+"/login/", params)
if err != nil {
t.Fatal(err)
}
defer resp.Body.Close() // This is not a thing you should need to error-check!
So errcheck lets you exclude function definitions in its invocation, like so: errcheck -exclude go_errcheck_excludes.txtn ./
(where go_errcheck_excludes.txt
is the file below).
Sadly, due to errcheck#132, it doesn't support the ReadCloser
's Close method, so you
have to reach for the much wider Closer
's Close. I think that's an OK trade-off to make, but your preferences might vary.