feat(golangci): enforce gofumpt (-extra) + gci import grouping#83
Merged
Conversation
golangci-lint v2 moved gofmt/gofumpt/gci out of linters into a separate formatters category that was never enabled, and the workflow only runs 'golangci-lint run' with no fmt gate — so formatting drift accumulated silently across the fleet (~38 unformatted files found in vibekit alone). Enable formatters in the canonical synced config: gofumpt with extra-rules (group adjacent same-type params, forbid naked returns) + gci with sections [standard, default, localmodule] and custom-order (deterministic std -> third-party -> local-module grouping; localmodule auto-reads each repo's go.mod). goimports is intentionally not enabled — it conflicts with gci on ordering and its add/remove is moot in CI (compiler rejects unused/missing) and handled by gopls in editors. No workflow change needed: 'golangci-lint run' reports enabled formatters as issues (verified, exit 1 on v2.12.2), so the existing lint step enforces this once the config propagates via sync.yaml. Each Go repo needs a one-time 'golangci-lint fmt' sweep; sync PRs self-gate (fail CI until the repo is formatted).
gofumpt folds first-party imports into the third-party group and never emits a separate local-import group, so gci localmodule/prefix sections can't converge with gofumpt (verified: domainless and domain repos both oscillated). [standard, default] converges for both domain libs and (domain-renamed) apps.
This was referenced Jun 8, 2026
cplieger
added a commit
to cplieger/auth
that referenced
this pull request
Jun 8, 2026
Apply the formatters now enforced centrally (cplieger/ci#83): gofumpt extra-rules + gci [standard, default]. Mechanical formatting only; build/vet/test verified.
cplieger
added a commit
to cplieger/httpx
that referenced
this pull request
Jun 8, 2026
Apply the formatters now enforced centrally (cplieger/ci#83): gofumpt extra-rules + gci [standard, default]. Mechanical formatting only; build/vet/test verified.
cplieger
added a commit
to cplieger/ssrf
that referenced
this pull request
Jun 8, 2026
Apply the formatters now enforced centrally (cplieger/ci#83): gofumpt extra-rules + gci [standard, default]. Mechanical formatting only; build/vet/test verified.
cplieger
added a commit
to cplieger/vterm
that referenced
this pull request
Jun 8, 2026
Apply the formatters now enforced centrally (cplieger/ci#83): gofumpt extra-rules + gci [standard, default]. Mechanical formatting only; build/vet/test verified.
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.
Why
golangci-lint v2 moved
gofmt/gofumpt/gciout oflintersinto a separateformatterscategory that this config never enabled, andgo-ci.yamlonly runsgolangci-lint runwith no fmt gate. Result: formatting drift accumulated silently fleet-wide (~38 unformatted Go files in vibekit alone;golangci-lint runreported 0 issues on them).What
Enable formatters in the canonical synced
.golangci.yaml:extra-rules: true— strictest (groups adjacent same-type params, forbids naked returns) on top of gofumpt's strict superset of gofmt.module-pathauto-detected per repo.sections: [standard, default, localmodule]+custom-order: true— deterministicstd → third-party → local-modulegrouping.localmoduleauto-reads each repo'sgo.mod, so it's uniform for both app modules (vibekit) and lib modules (github.com/cplieger/x).goimports is intentionally not enabled: it conflicts with gci on ordering, and its only unique capability (add/remove imports) is moot in CI (the compiler rejects unused/missing) and is handled by gopls in editors.
Enforcement & propagation
golangci-lint runreports enabled formatters as issues (verified on v2.12.2:File is not properly formatted (gci), exit 1), so the existing lint step enforces this once the config propagates via sync.yaml to every Go repo.golangci-lint fmtsweep. Sync PRs self-gate: a repo'schore(sync)PR fails CI until that repo is formatted, so land the per-repo sweep first (or alongside). vibekit's sweep is in flight.Validated:
golangci-lint config verifyclean;golangci-lint fmt --diffexits 1 on drift.