Skip to content

upgrade to Golangci-lint v2; add lint to CI#1832

Merged
kavirajk merged 5 commits intoClickHouse:mainfrom
alexandear-org:chore/upgrade-golangci-lint-v2
Apr 20, 2026
Merged

upgrade to Golangci-lint v2; add lint to CI#1832
kavirajk merged 5 commits intoClickHouse:mainfrom
alexandear-org:chore/upgrade-golangci-lint-v2

Conversation

@alexandear
Copy link
Copy Markdown
Contributor

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:

  • simplify slice initialization in various files
  • replace interface{} with any in multiple locations

Copilot AI review requested due to automatic review settings April 16, 2026 13:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-lint in CI.
  • Migrate .golangci.yaml to the v2 configuration schema.
  • Apply lint-driven refactors across the Go codebase (slice initialization simplifications, interface{}any, minor formatting/IO improvements, and bodyclose suppressions 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.

Comment thread .golangci.yaml Outdated
Comment thread .golangci.yaml
Comment thread .github/workflows/run-lint.yml
@alexandear alexandear force-pushed the chore/upgrade-golangci-lint-v2 branch from b17511b to 0520697 Compare April 16, 2026 13:23
Copy link
Copy Markdown
Contributor

@kavirajk kavirajk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @alexandear for the PR. Can you address few minor comments?

Comment thread .golangci.yaml
Comment thread .golangci.yaml Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/cmd/release/main.go
Comment thread internal/cmd/release/main.go
@alexandear
Copy link
Copy Markdown
Contributor Author

thanks @alexandear for the PR. Can you address few minor comments?

@kavirajk thank you for the review. Addressed comments.

@kavirajk
Copy link
Copy Markdown
Contributor

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 :)

@kavirajk kavirajk merged commit 27f6ead into ClickHouse:main Apr 20, 2026
19 of 20 checks passed
@alexandear alexandear deleted the chore/upgrade-golangci-lint-v2 branch April 20, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants