Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor(astutils): remove redundant nil check in Walk
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 committed Aug 26, 2023
commit 5df291ec55525e94adb77d2fde05fd83a5530d7d
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