Skip to content

Commit 1902f62

Browse files
committed
Fix lint: use if instead of switch, avoid variable shadowing
1 parent e422ac7 commit 1902f62

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

internal/stackql/astindirect/cte_indirect.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ func (c *CTE) extractColumnsFromSelect() []string {
4343
return columns
4444
}
4545
for _, expr := range sel.SelectExprs {
46-
switch e := expr.(type) {
47-
case *sqlparser.AliasedExpr:
46+
if e, isAliased := expr.(*sqlparser.AliasedExpr); isAliased {
4847
// Use alias if present, otherwise try to get column name
4948
if e.As.GetRawVal() != "" {
5049
columns = append(columns, e.As.GetRawVal())
51-
} else if col, ok := e.Expr.(*sqlparser.ColName); ok {
50+
} else if col, isCol := e.Expr.(*sqlparser.ColName); isCol {
5251
columns = append(columns, col.Name.GetRawVal())
5352
}
5453
}

0 commit comments

Comments
 (0)