build(ci): migrate .golangci.yml to v2 schema (closes #62)#89
Merged
Conversation
The pre-fix .golangci.yml targeted the golangci-lint v1 schema (no `version:` field, flat `linters.enable`, `output.formats` as a slice). The Makefile told contributors to `brew install golangci-lint` — which installs the current major version, v2.x, today. Any contributor with a current Homebrew got: Error: can't load config: can't unmarshal config by viper (flags, file): 1 error(s) decoding: * 'output.formats' expected a map, got 'slice' … instead of a lint failure, blocking `make lint` and `make ci` end-to-end. CI was unaffected because the GitHub Action pinned to v1.64.8, but the local dev workflow was effectively broken for anyone following the documented install steps. Migration via `golangci-lint migrate` plus a hand-rewrite to preserve the descriptive comments (migrate strips them). Net schema changes: - `version: "2"` added - `output.formats` is now a map (`text:`), not a list - `linters.disable-all: true` → `linters.default: none` - `gofmt` / `goimports` linters moved into the new `formatters:` section (with `local-prefixes` now a list) - `linters-settings:` → `linters.settings:` - New `linters.exclusions:` block with the same per-rule exclusions the v1 file had (test files, windows-only files, upgrade.go cross-file refs), plus a presets list (`comments`, `common-false-positives`, `legacy`, `std-error-handling`) for v2's broader exclusion grammar gosimple was folded into staticcheck in v2; the linters list is otherwise the same (bodyclose, contextcheck, errcheck, gocritic, govet, ineffassign, misspell, staticcheck, unused). CI bumps: - golangci/golangci-lint-action@v6 → @v8 - version: v1.64.8 → v2.12.2 (matches the version Homebrew currently ships, so local `make lint` agrees byte-for-byte with CI) Makefile `lint` target now checks for the binary and prints the exact `go install github.com/golangci/golangci-lint/v2/... @v2.12.2` command matching the CI pin when it's missing — so a contributor without golangci-lint gets a fix-the-install hint instead of a confusing exec failure. Confirmed locally: `make ci` is now green on a Homebrew v2.12.2 install (lint + vet + test all pass, 0 issues). Refs #62
|
✔️ b00b991 - Conventional commits check succeeded. |
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.
Summary
.golangci.ymltargets the v2 schema (version: "2") — fixing the silent-parse-failure mode that mademake lintandmake cicompletely unusable for any contributor with a current Homebrew (which ships v2.x by default today). CI bumpsgolangci/lint-action@v6 → @v8and pinsversion: v2.12.2to match what Homebrew installs locally. The Makefilelinttarget now checks for the binary and prints the exactgo install ...@v2.12.2command matching the CI pin when missing.Same lint set + exclusion rules + presets that v1 ran with still apply — confirmed by
make cishowing0 issueslocally on a Homebrew v2.12.2 install.Linked issues
Closes #62
Type of change
feat— new feature (MINOR bump)fix— bug fix (PATCH bump)refactor— no behavior changeperf— performance improvementdocs— documentation onlytest— tests onlychore— maintenance / dependency bumpci— CI/CD onlybuild— build system onlyChecklist
feat(scope): subject)make cilocally and it passes (tidy/fmt/vet/lint/test all green, 0 lint issues)docs/, inline comments)Screenshots / output
Pre-fix reproduction (Homebrew's stock v2.12.2):
make cihad the same blocker (lint is in its dependency chain), so the documented local-dev workflow was effectively broken for any contributor with Homebrew's current default — they could only run vet/test, never lint.Post-fix (same Homebrew v2.12.2):
Missing-binary case (handy because contributors won't always have golangci-lint installed):
Files touched
.golangci.yml— migrated to the v2 schema withgolangci-lint migrate. Top-of-file comments (whichmigratewarns it strips) were re-added by hand to preserve the rationale for the lint set + exclusion paths. Schema-level diff:version: "2"field added.output.formatsis now a map (text:), not a list — fixing the v1-vs-v2 parse failure.linters.disable-all: true→linters.default: none.linters-settings:→linters.settings:.gofmt/goimportsmoved fromlinters.enable:into a new top-levelformatters:block (v2's grammar for fmt-vs-lint).goimports.local-prefixesis now a list, not a single string.linters.exclusions:block preserves v1's per-rule exclusions (test files, windows-only symbols, upgrade.go cross-file refs) and adds v2'spresets: [comments, common-false-positives, legacy, std-error-handling]for the broader exclusion grammar.gosimpleis removed fromenable:(folded intostaticcheckin v2). Everything else (bodyclose, contextcheck, errcheck, gocritic, govet, ineffassign, misspell, staticcheck, unused) stays..github/workflows/ci.yml—golangci/golangci-lint-action@v6→@v8.version: v1.64.8→v2.12.2(matches Homebrew's current default so local matches CI byte-for-byte).Makefile—lint:target now checks for the binary first; if missing, prints the exactgo install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2command (matching the CI pin) so a missing-install surfaces a fix-it hint, not an exec failure.CHANGELOG.md—### Fixedentry under[Unreleased]documenting the migration with the build(lint): .golangci.yml v1 schema incompatible with golangci-lint v2 (brew installs v2, make lint fails to even parse config) #62 reference.