Skip to content

Commit 2137b6c

Browse files
committed
refactor(assignment): refactor check assignment return value
1 parent c0b7cde commit 2137b6c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

errcheck/errcheck.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,16 +607,17 @@ func (v *visitor) Visit(node ast.Node) ast.Visitor {
607607
return v
608608
}
609609

610+
// checkAssignment checks the assignment statement and returns a boolean value
611+
// indicating whether to continue checking the substructure in AssignStmt or not
610612
func (v *visitor) checkAssignment(lhs, rhs []ast.Expr) (followed bool) {
611-
followed = true
612613
if len(rhs) == 1 {
613614
// single value on rhs; check against lhs identifiers
614615
if call, ok := rhs[0].(*ast.CallExpr); ok {
615616
if !v.blank {
616-
return
617+
return true
617618
}
618619
if v.ignoreCall(call) {
619-
return
620+
return true
620621
}
621622
isError := v.errorsByArg(call)
622623
for i := 0; i < len(lhs); i++ {
@@ -674,7 +675,7 @@ func (v *visitor) checkAssignment(lhs, rhs []ast.Expr) (followed bool) {
674675
}
675676
}
676677

677-
return
678+
return true
678679
}
679680

680681
func (v *visitor) checkAssertExpr(expr *ast.TypeAssertExpr) {

0 commit comments

Comments
 (0)