timakin / bodyclose

Analyzer: checks whether HTTP response body is closed and a re-use of TCP connection is not blocked.
MIT License
309 stars 33 forks source link

False positive: if function returns io.ReadCloser #27

Closed tdakkota closed 4 years ago

tdakkota commented 4 years ago

Example:

func download(url string) (io.ReadCloser, error) { // body should be closed by User
    r, err := http.DefaultClient.Get(url)
    if err != nil {
        return nil, err
    }
    return r.Body, nil
}