timakin/bodyclose

False positive when using `httptest.NewRecorder()`

SergeShpak opened this issue · 0 comments

This code triggers a false positive:

func issues() {
	w := httptest.NewRecorder()
	resp := w.Result()
	defer func() {
		_ = resp.Body.Close()
	}()
	_, _ = io.ReadAll(resp.Body)
}