Skip to content

False positive when a loop var is exported, directly followed by break #14

Closed as not planned
@alvaroaleman

Description

@alvaroaleman

exportloopref complains about something like this, even though it is valid:

var result *int
haystack := []int{1, 2}
for _, hay := range haystack {
 if true {
   result = &hay
   break
  }
}

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions