Skip to content

Commit

Permalink
refactor(assignment): refactor check assignment return value
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorgan committed Jun 15, 2024
1 parent c0b7cde commit 2137b6c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions errcheck/errcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,16 +607,17 @@ func (v *visitor) Visit(node ast.Node) ast.Visitor {
return v
}

// checkAssignment checks the assignment statement and returns a boolean value
// indicating whether to continue checking the substructure in AssignStmt or not
func (v *visitor) checkAssignment(lhs, rhs []ast.Expr) (followed bool) {
followed = true
if len(rhs) == 1 {
// single value on rhs; check against lhs identifiers
if call, ok := rhs[0].(*ast.CallExpr); ok {
if !v.blank {
return
return true
}
if v.ignoreCall(call) {
return
return true
}
isError := v.errorsByArg(call)
for i := 0; i < len(lhs); i++ {
Expand Down Expand Up @@ -674,7 +675,7 @@ func (v *visitor) checkAssignment(lhs, rhs []ast.Expr) (followed bool) {
}
}

return
return true
}

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

0 comments on commit 2137b6c

Please # to comment.