diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml index 0f9c293..8d9cb51 100644 --- a/.github/workflows/golang.yaml +++ b/.github/workflows/golang.yaml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.22.2' + go-version: '1.24.1' cache-dependency-path: "**/*.sum" - uses: actions/checkout@v4 - run: go mod verify @@ -31,7 +31,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.22.2' + go-version: '1.24.1' cache-dependency-path: "**/*.sum" - uses: actions/checkout@v4 - run: go mod verify @@ -44,7 +44,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.22.2' + go-version: '1.24.1' cache-dependency-path: "**/*.sum" - uses: actions/checkout@v4 - run: go mod verify @@ -61,7 +61,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.22.2' + go-version: '1.24.1' cache-dependency-path: "**/*.sum" - uses: actions/checkout@v4 - run: go vet ./... @@ -78,17 +78,17 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.22.2' + go-version: '1.24.1' cache-dependency-path: "**/*.sum" - uses: actions/checkout@v4 - - uses: golangci/golangci-lint-action@v6 + - uses: golangci/golangci-lint-action@v7 with: - version: 'v1.57.2' - - uses: golangci/golangci-lint-action@v6 + version: 'v2.0.1' + - uses: golangci/golangci-lint-action@v7 with: working-directory: 'fuzz' - version: 'v1.57.2' - - uses: golangci/golangci-lint-action@v6 + version: 'v2.0.1' + - uses: golangci/golangci-lint-action@v7 with: working-directory: 'integration' - version: 'v1.57.2' + version: 'v2.0.1' diff --git a/filter/util.go b/filter/util.go index 9634b01..e94f99c 100644 --- a/filter/util.go +++ b/filter/util.go @@ -58,7 +58,7 @@ func isValidPostgresIdentifier(s string) bool { } // The first character needs to be a letter or _ - if !(s[0] >= 'a' && s[0] <= 'z') && !(s[0] >= 'A' && s[0] <= 'Z') && s[0] != '_' { + if (s[0] < 'a' || s[0] > 'z') && (s[0] < 'A' || s[0] > 'Z') && s[0] != '_' { return false } diff --git a/integration/postgres_test.go b/integration/postgres_test.go index 3c027f6..5ada588 100644 --- a/integration/postgres_test.go +++ b/integration/postgres_test.go @@ -73,7 +73,6 @@ func TestIntegration_ReadmeExample(t *testing.T) { if err != nil { t.Fatal(err) } - defer rows.Close() ids := []int{} for rows.Next() { var id int @@ -82,6 +81,9 @@ func TestIntegration_ReadmeExample(t *testing.T) { } ids = append(ids, id) } + if err := rows.Err(); err != nil { + t.Fatal(err) + } if len(ids) != 2 { t.Fatalf("expected 2 rows, got %d", len(ids)) @@ -137,7 +139,6 @@ func TestIntegration_InAny_PQ(t *testing.T) { if err != nil { t.Fatal(err) } - defer rows.Close() ids := []int{} for rows.Next() { var id int @@ -146,6 +147,9 @@ func TestIntegration_InAny_PQ(t *testing.T) { } ids = append(ids, id) } + if err := rows.Err(); err != nil { + t.Fatal(err) + } if len(ids) != 8 { t.Fatalf("expected 8 rows, got %d", len(ids)) @@ -202,7 +206,6 @@ func TestIntegration_InAny_PGX(t *testing.T) { if err != nil { t.Fatal(err) } - defer rows.Close() ids := []int{} for rows.Next() { var id int @@ -211,6 +214,9 @@ func TestIntegration_InAny_PGX(t *testing.T) { } ids = append(ids, id) } + if err := rows.Err(); err != nil { + t.Fatal(err) + } if len(ids) != 8 { t.Fatalf("expected 8 rows, got %d", len(ids)) @@ -466,7 +472,6 @@ func TestIntegration_BasicOperators(t *testing.T) { } return } - defer rows.Close() players := []int{} for rows.Next() { var id int @@ -475,6 +480,9 @@ func TestIntegration_BasicOperators(t *testing.T) { } players = append(players, id) } + if err := rows.Err(); err != nil { + t.Fatal(err) + } if !reflect.DeepEqual(players, tt.expectedPlayers) { t.Fatalf("expected %v, got %v", tt.expectedPlayers, players) @@ -536,7 +544,6 @@ func TestIntegration_NestedJSONB(t *testing.T) { if err != nil { t.Fatal(err) } - defer rows.Close() players := []int{} for rows.Next() { var id int @@ -545,6 +552,9 @@ func TestIntegration_NestedJSONB(t *testing.T) { } players = append(players, id) } + if err := rows.Err(); err != nil { + t.Fatal(err) + } if !reflect.DeepEqual(players, tt.expectedPlayers) { t.Fatalf("%q expected %v, got %v (conditions used: %q)", tt.input, tt.expectedPlayers, players, conditions) @@ -604,7 +614,6 @@ func TestIntegration_Logic(t *testing.T) { if err != nil { t.Fatal(err) } - defer rows.Close() players := []int{} for rows.Next() { var id int @@ -613,6 +622,9 @@ func TestIntegration_Logic(t *testing.T) { } players = append(players, id) } + if err := rows.Err(); err != nil { + t.Fatal(err) + } if !reflect.DeepEqual(players, tt.expectedPlayers) { t.Fatalf("%q expected %v, got %v (conditions used: %q)", tt.input, tt.expectedPlayers, players, conditions) diff --git a/integration/setup_test.go b/integration/setup_test.go index 9e07e57..99b3da0 100644 --- a/integration/setup_test.go +++ b/integration/setup_test.go @@ -29,7 +29,7 @@ func setupPQ(t *testing.T) *sql.DB { return db.PingContext(ctx) }) t.Cleanup(func() { - db.Close() + db.Close() //nolint:errcheck }) return db