-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Closed
Copy link
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.RefactoringIssues related to refactoring toolsIssues related to refactoring toolsgoplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.
Milestone
Description
Consider this stditerators modernization observed in CL 718504, a not uncommon pattern:
for i := 0; i < T.NumFields(); i++ {
if prev := T.Field(i); prev.Name() == r.to {=>
for field0 := range T.Fields() {
if prev := field0; prev.Name() == r.to {(Ignore the choice of name field0, as this is the topic of #76240.)
The assignment prev := field0 is redundant. The analyzer should recognize this pattern and choose the name prev in this case, deleting the IfStmt.Init statement.
Metadata
Metadata
Assignees
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.RefactoringIssues related to refactoring toolsIssues related to refactoring toolsgoplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.