Skip to content

Modernize golangci-lint config#63

Merged
tamalsaha merged 1 commit into
masterfrom
ci/golangci-lint-gofumpt
Jul 11, 2026
Merged

Modernize golangci-lint config#63
tamalsaha merged 1 commit into
masterfrom
ci/golangci-lint-gofumpt

Conversation

@tamalsaha

Copy link
Copy Markdown
Member

Summary

Modernize the .golangci.yml configuration for golangci-lint v2 and switch the configured formatter to gofumpt.

This aligns the linter with the build image (ghcr.io/appscode/golang-dev), where gofmt is a shim to gofumpt — so make fmt (via hack/fmt.sh's gofmt -s -w) and the linter now enforce the same formatting. No change to hack/fmt.sh is needed.

.golangci.yml

  • Enable bodyclose and prealloc linters (unparam was already enabled).
  • Move exclude-files / exclude-dirs out of the deprecated issues: block into linters.exclusions.paths — the correct location in golangci-lint v2.
  • Fix the over-escaped exclusion regex generated.*\\.gogenerated.*\.go.
  • Switch the formatter from gofmtgofumpt and drop the now-unneeded interface{}any rewrite rule (gofumpt performs this itself at go1.18+).

Resulting formatting

  • gofumpt reformatting applied across the affected Go files.

- Enable bodyclose and prealloc linters
- Move exclude-files/exclude-dirs to linters.exclusions.paths (golangci-lint
  v2 location) and fix over-escaped regex generated.*\\.go -> generated.*\.go
- Switch formatter from gofmt to gofumpt and drop the interface{} -> any
  rewrite rule (gofumpt is a stricter superset)
- Apply resulting gofumpt formatting

Signed-off-by: Tamal Saha <tamal@appscode.com>
@tamalsaha tamalsaha merged commit d1d01e5 into master Jul 11, 2026
4 checks passed
@tamalsaha tamalsaha deleted the ci/golangci-lint-gofumpt branch July 11, 2026 12:24
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.

1 participant