Skip to content

Commit

Permalink
refactor(astutils): remove redundant nil check in Walk (#2660)
Browse files Browse the repository at this point in the history
From the Go docs:

  "For a nil slice, the number of iterations is 0." [1]

Therefore, an additional nil check for before the loop is unnecessary.

[1]: https://go.dev/ref/spec#For_range

Signed-off-by: Eng Zer Jun <[email protected]>
  • Loading branch information
Juneezee authored Aug 28, 2023
1 parent 8be0e2f commit ecf4980
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/sql/astutils/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -2158,10 +2158,8 @@ func Walk(f Visitor, node ast.Node) {
}

case *ast.In:
if n.List != nil {
for _, l := range n.List {
Walk(f, l)
}
for _, l := range n.List {
Walk(f, l)
}
if n.Sel != nil {
Walk(f, n.Sel)
Expand Down

0 comments on commit ecf4980

Please sign in to comment.