var rc io.ReadCloser
if true {
resp, err := http.Get("http://foo")
rc = resp.Body
if err != nil {
print(err)
}
}
defer rc.Close()
This highlights a false-positive when resp.Body is closed outsite the if body. Removing the if wrapping makes it correctly detect it.