Skip to content

style: fix gofmt drift and gate formatting in CI - #46

Merged
thanhleviet merged 2 commits into
mainfrom
chore/gofmt-drift
Aug 5, 2026
Merged

thanhleviet merged 2 commits into
mainfrom
chore/gofmt-drift

Conversation

@thanhleviet

Copy link
Copy Markdown
Collaborator

Five files on main were not gofmt-clean. This formats them and adds the check that would have caught it.

style: apply gofmt to five drifted files

Ordinary formatting, no version-specific rules involved:

  • internal/cli/download_cmd.go - var-block alignment went stale when maxSamples int was added.
  • internal/index/query.go - userColToSQL map alignment went stale when the longer Completeness_General key 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 -w across all five files shows nothing but the one import line, so everything else is whitespace.
  • go build -trimpath ./cmd/atb produces a byte-identical binary before and after (9b058488…).
  • Go 1.23's gofmt and Go 1.25's gofmt flag the same five files and emit byte-identical output, so this is not a toolchain difference.
  • go vet ./... clean, go test ./... green across 22 packages.

ci: check formatting in the lint job

Nothing in the repo checked formatting, which is why the drift survived:

  • The CI Lint job ran only go vet ./... and go build ./....
  • make lint runs golangci-lint run ./... with no config file, and gofmt is not among golangci-lint's default linters.
  • CI never invokes make lint, so the two things named "lint" had diverged anyway.

The new Format check step runs gofmt -l . and prints the offending paths. Tested both directions against a git archive export, which is exactly what CI checks out: exit 1 listing all five files against 4c77c14, exit 0 against this branch.

The job's go-version moves from "1.23" to "1.25". go.mod declares go 1.25.0, so with the default GOTOOLCHAIN=auto every go command in that job already downloaded and switched to 1.25 - GOTOOLCHAIN=go1.23.0 go build fails outright with go.mod requires go >= 1.25.0. gofmt is 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 test matrix and the coverage job still say go: "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.

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.
@thanhleviet
thanhleviet merged commit b003b49 into main Aug 5, 2026
6 checks passed
@thanhleviet
thanhleviet deleted the chore/gofmt-drift branch August 5, 2026 17:37
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