upgrade to Golangci-lint v2; add lint to CI#1832
Conversation
There was a problem hiding this comment.
Pull request overview
This PR upgrades the repository’s linting setup to GolangCI-Lint v2 and introduces a dedicated CI workflow to run linting on pushes/PRs to main, along with a set of mechanical code cleanups surfaced by the new lint rules.
Changes:
- Add a GitHub Actions workflow to run
golangci-lintin CI. - Migrate
.golangci.yamlto the v2 configuration schema. - Apply lint-driven refactors across the Go codebase (slice initialization simplifications,
interface{}→any, minor formatting/IO improvements, andbodyclosesuppressions where responses are closed indirectly).
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/meta.go | Simplifies slice allocation in supported-versions formatting. |
| lib/proto/block.go | Simplifies slice allocations during block decode. |
| lib/column/tuple.go | Minor string formatting change for conversion error messages. |
| lib/column/nested.go | Simplifies slice allocation in DDL formatting helper. |
| lib/column/map.go | Simplifies slice allocation while parsing map types. |
| lib/column/json_reflect.go | Switches reflective map type from interface{} to any. |
| lib/column/json.go | Removes unused map lookup boolean in JSON object append path. |
| lib/column/ipv6.go | Import grouping + slice allocation simplifications in IPv6 append paths. |
| lib/column/ipv4.go | Slice allocation simplifications in IPv4 append paths. |
| lib/column/enum.go | Removes redundant break statements in a switch. |
| lib/column/array.go | Uses any for reflective “scan any” type. |
| lib/chcol/variant.go | Updates sql.Scanner signature to use any. |
| lib/chcol/json.go | Updates sql.Scanner signature to use any. |
| internal/cmd/release/main.go | Replaces WriteString(fmt.Sprintf(...)) with fmt.Fprintf(...). |
| conn_http_query.go | Adds //nolint:bodyclose annotation for a bodyclose false-positive site. |
| conn_http_exec.go | Adds //nolint:bodyclose annotation for a bodyclose false-positive site. |
| conn_http_batch.go | Adds //nolint:bodyclose annotation for a bodyclose false-positive site. |
| conn_http_async_insert.go | Adds //nolint:bodyclose annotation for a bodyclose false-positive site. |
| client_info.go | Simplifies slice appends using variadic .... |
| clickhouse_std.go | Simplifies nil/len check on address slice. |
| clickhouse_options.go | Simplifies nil/len check on address slice in defaults. |
| bind.go | Simplifies slice allocation in join helper. |
| .golangci.yaml | Migrates to GolangCI-Lint v2 schema; reorganizes enabled checks and exclusions. |
| .github/workflows/run-lint.yml | Adds a lint workflow running golangci-lint in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b17511b to
0520697
Compare
kavirajk
left a comment
There was a problem hiding this comment.
thanks @alexandear for the PR. Can you address few minor comments?
0520697 to
a8841b5
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 254 out of 254 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@kavirajk thank you for the review. Addressed comments. |
|
Thanks @alexandear 👍 for addressing the remarks. nit: avoid force pushing in the future once review is started. Makes it hard for reviewer to review only latest changes :) |
Summary
Add linting workflow and migrate Golangci-lint configuration to v2 (v1 is deprecated).
The upgrade reveals a few lint issues that I fixed as well: