Don't check names in non-declaration assignment statements.
diff --git a/lint.go b/lint.go
index dffff3f..b63914b 100644
--- a/lint.go
+++ b/lint.go
@@ -270,6 +270,9 @@
f.walk(func(node ast.Node) bool {
switch v := node.(type) {
case *ast.AssignStmt:
+ if v.Tok == token.ASSIGN {
+ return true
+ }
for _, exp := range v.Lhs {
if id, ok := exp.(*ast.Ident); ok {
check(id, "var")
diff --git a/testdata/names.go b/testdata/names.go
index e923980..25f5901 100644
--- a/testdata/names.go
+++ b/testdata/names.go
@@ -14,6 +14,9 @@
func f_it() { // MATCH /underscore.*func.*f_it/
more_underscore := 4 // MATCH /underscore.*var.*more_underscore/
+ if true {
+ more_underscore = 7 // should be okay
+ }
x := foo_proto.Blah{} // should be okay
}