Skip to content

ci: check formatting with golangci-lint's gofmt formatter - #2602

Open
eyoshioka wants to merge 2 commits into
oapi-codegen:mainfrom
eyoshioka:ci/2409-check-gofmt
Open

eyoshioka wants to merge 2 commits into
oapi-codegen:mainfrom
eyoshioka:ci/2409-check-gofmt

Conversation

@eyoshioka

@eyoshioka eyoshioka commented Oct 8, 2026 •

Copy link
Copy Markdown

Closes #2409.

As proposed in my comment, this enables golangci-lint's gofmt formatter, so make lint, and therefore CI, fails on unformatted code. The enabled linters stay at golangci-lint's defaults.

  • The first commit runs gofmt -w on the 11 files that currently fail. Apart from an import order in pkg/codegen/utils.go, the changes are whitespace only.
  • The second commit adds .golangci.yml.

With the new config, make lint fails on the current main and passes with the first commit in every module. If you'd rather add the check to oapi-codegen/actions, I'll drop the second commit.

eyoshioka and others added 2 commits October 8, 2026 14:44
Generated with:

    git ls-files '*.go' | xargs gofmt -l | xargs gofmt -w

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`make lint` runs golangci-lint, so enabling its gofmt formatter makes CI
fail on unformatted code. The linters stay at golangci-lint's defaults.

Closes oapi-codegen#2409

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@eyoshioka
eyoshioka marked this pull request as ready for review October 8, 2026 10:40
@eyoshioka
eyoshioka requested a review from a team as a code owner October 8, 2026 10:40
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low risk] Adds code formatting configuration and reformats test files.

This PR appears safe to merge.

What we checked:

  • Local lint accepts version two: The root Makefile pins golangci-lint to v2.14.0 and passes that same binary to both child modules.

Summary

Adds gofmt checks through .golangci.yml and formats eleven existing Go files.

  • Keeps the default linters.
  • Preserves Go behavior and generated APIs.
  • No actionable issues found.

Reviews (1) · Last reviewed commit: "ci: check formatting with golangci-lint'..." · Reviewed by Greptile

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.

ci: run go fmt

1 participant