Skip to content

Commit ecf4980

Browse files
authored
refactor(astutils): remove redundant nil check in Walk (#2660)
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 <engzerjun@gmail.com>
1 parent 8be0e2f commit ecf4980

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

internal/sql/astutils/walk.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,10 +2158,8 @@ func Walk(f Visitor, node ast.Node) {
21582158
}
21592159

21602160
case *ast.In:
2161-
if n.List != nil {
2162-
for _, l := range n.List {
2163-
Walk(f, l)
2164-
}
2161+
for _, l := range n.List {
2162+
Walk(f, l)
21652163
}
21662164
if n.Sel != nil {
21672165
Walk(f, n.Sel)

0 commit comments

Comments
 (0)