From ecf4980574d007a40f081dfcc5351d660c27209b Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Tue, 29 Aug 2023 03:39:48 +0800 Subject: [PATCH] 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 --- internal/sql/astutils/walk.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/sql/astutils/walk.go b/internal/sql/astutils/walk.go index 9f26617ad3..0943379f03 100644 --- a/internal/sql/astutils/walk.go +++ b/internal/sql/astutils/walk.go @@ -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)