style: fix gofmt drift and gate formatting in CI - #46
Merged
Merged
Conversation
Alignment in two var blocks and a map literal went stale when longer names were added, and one import was ordered by its alias instead of its path. The compiled binary is byte-identical before and after.
The job ran only vet and build, and `make lint` uses golangci-lint defaults, which exclude gofmt. Nothing checked formatting, so drift survived. The job now pins Go 1.25 because gofmt is a standalone binary and does not follow the toolchain switch that go.mod triggers for go commands.
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.
Five files on
mainwere not gofmt-clean. This formats them and adds the check that would have caught it.style: apply gofmt to five drifted filesOrdinary formatting, no version-specific rules involved:
internal/cli/download_cmd.go- var-block alignment went stale whenmaxSamples intwas added.internal/index/query.go-userColToSQLmap alignment went stale when the longerCompleteness_Generalkey was added.internal/cli/query_cmd.go-pq "…/internal/parquet"was sorted by its alias instead of its import path, so it sat above"…/internal/output".internal/query/executor_test.go,internal/selfupdate/selfupdate.go- alignment only.Verification:
git diff -wacross all five files shows nothing but the one import line, so everything else is whitespace.go build -trimpath ./cmd/atbproduces a byte-identical binary before and after (9b058488…).go vet ./...clean,go test ./...green across 22 packages.ci: check formatting in the lint jobNothing in the repo checked formatting, which is why the drift survived:
Lintjob ran onlygo vet ./...andgo build ./....make lintrunsgolangci-lint run ./...with no config file, and gofmt is not among golangci-lint's default linters.make lint, so the two things named "lint" had diverged anyway.The new
Format checkstep runsgofmt -l .and prints the offending paths. Tested both directions against agit archiveexport, which is exactly what CI checks out: exit 1 listing all five files against4c77c14, exit 0 against this branch.The job's
go-versionmoves from"1.23"to"1.25".go.moddeclaresgo 1.25.0, so with the defaultGOTOOLCHAIN=autoeverygocommand in that job already downloaded and switched to 1.25 -GOTOOLCHAIN=go1.23.0 go buildfails outright withgo.mod requires go >= 1.25.0.gofmtis a standalone binary and does not follow that switch, so a"1.23"pin would check formatting with a different gofmt than the version the module requires. The other workflows (release.yml,pages.yml,docs.yml) already pin"1.25".Not changed
The
testmatrix and thecoveragejob still saygo: "1.23", which is misleading for the same reason - they auto-upgrade to 1.25 and cannot run 1.23. Correcting that is a statement about which versions the project supports, so it is left alone here.No CHANGELOG entry: no user-visible behavior changes.