Skip to content

Commit 69e9ae1

Browse files
committed
Explain getRootIdent/ObjectOf/Pos check
1 parent 0e13d06 commit 69e9ae1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/analyzer/analyzer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ func run(pass *analysis.Pass) (interface{}, error) {
5555
break
5656
}
5757

58+
// allow assignment to non-pointer children of values defined within the loop
5859
if lhs := getRootIdent(pass, assignStmt.Lhs[0]); lhs != nil {
5960
if obj := pass.TypesInfo.ObjectOf(lhs); obj != nil {
6061
if obj.Pos() >= body.Pos() && obj.Pos() < body.End() {
61-
continue
62+
continue // definition is within the loop
6263
}
6364
}
6465
}

0 commit comments

Comments
 (0)