ci: gate Go formatting on gofmt - #53
Merged
Merged
Conversation
Nothing checked Go formatting here. golangci-lint ran without a formatter enabled, so `task lint` and CI were both blind to it, and files drifted out of gofmt shape without any gate noticing — struct-tag alignment, trailing-comment alignment, method-body alignment across fourteen files. Enables the gofmt formatter in .golangci.yml. `golangci-lint run` reports an unformatted file as an issue, so the same command already wired into `task lint` and the CI lint job now fails on one; no new step and no new tool. The fourteen files are brought into shape in the same commit, because a gate that lands red is a gate someone turns off. `git diff -w` over this change is empty: every Go edit here is whitespace, and no statement, signature or tag value moves. Negative-tested: with the gate enabled, misaligning a single trailing comment fails `golangci-lint run`, and restoring it passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Enables the
gofmtformatter in.golangci.yml, and brings the fourteen files that had drifted back into shape.Why
Nothing checked Go formatting in this repo.
golangci-lintran with no formatter enabled, sotask lintand the CI lint job were both blind to it — and files drifted without any gate noticing: struct-tag alignment, trailing-comment alignment, method-body alignment.I found it the ordinary way:
gofmt -won a test file I was editing for an unrelated change also realigned a const block that was already unformatted onmain.Why golangci-lint rather than a CI step
golangci-lint runreports an unformatted file as an issue, so the command already wired intotask lintand the CI lint job now fails on one. No new step, no new tool, and the local command stays identical to the CI command.Proven before the cleanup, against the unformatted tree:
(exit 1; output caps at three of the same issue, there were fourteen)
The reformat is semantically inert
git diff -wover this change is empty — every Go edit is whitespace. No statement, signature, or tag value moves.The fourteen files land in the same commit as the gate deliberately: a gate that lands red is a gate someone turns off.
Negative-tested
With the gate enabled, misaligning one trailing comment in
internal/cost/diff.go:golangci-lint runVerification
task build,task test(26 packages),task lint(0 issues),scripts/check-context.sh,scripts/coverage.sh— all green, every floor met.