noctx icon indicating copy to clipboard operation
noctx copied to clipboard

False Negative: return http.Request from closure

Open sonatard opened this issue 4 years ago • 0 comments

req, _ := http.NewRequest(http.MethodPost, url, nil)       // want `should rewrite http.NewRequestWithContext or add \(\*Request\).WithContext`
_, _ = func() (*http.Request, error) { return req, nil }() // OK
cli.Do(req)
=== RUN   Test
--- FAIL: Test (0.63s)
    analysistest.go:324: a/a.go:33: no diagnostic was reported matching "should rewrite http.NewRequestWithContext or add \\(\\*Request\\).WithContext"
FAIL

Process finished with exit code 1

sonatard avatar Jun 06 '20 16:06 sonatard