Skip to content

False positive with closure outside of if body #77

Description

@silverwind
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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions