Golangci-lint Maintenance Workflow¶
This document defines a future-facing workflow for maintaining .golangci.yaml.
It is a policy for how to update, review, and validate linter configuration, not a changelog of past edits.
Scope¶
- Target file:
.golangci.yaml - Authoritative references:
- https://golangci-lint.run/docs/configuration/file/
- https://golangci-lint.run/docs/linters/configuration/
Principles¶
- Keep changes minimal and reviewable.
- Apply explicit markers only to changed lines:
(Deprecated)
- Keep
linters.settingsentries in A-Z order under the root. - Do not keep stale configuration:
- If a linter is not present in current official docs, remove it from both
linters.enableandlinters.settings.
- If a linter is not present in current official docs, remove it from both
Workflow¶
- Discover current linter set.
- Classify each target linter as one of:
enable,comment out,remove,deprecated. - Apply
linters.enableupdates with markers on changed lines only. - Apply
linters.settingsupdates in A-Z order. - Remove unsupported linters line-by-line from both sections.
- Run verification gates before finalizing.
Stage 1: Discover¶
- Pull the local authoritative list from the installed binary.
- Confirm deprecated status from the same source.
Stage 2: Edit¶
- Update
linters.enablefirst, thenlinters.settings. - For linters with no configurable settings in official docs:
- Do not add schema-breaking YAML keys.
- Add a commented placeholder in
linters.settingsif traceability is needed.
Stage 3: Clean Up¶
- Remove unknown or obsolete linters from:
linters.enablelinters.settings
- Mark deprecated linters in
linters.enablewith(Deprecated).
Decision Rules¶
- Enable a linter only when it provides clear net value and acceptable noise.
- Keep candidates commented out when impact is uncertain.
- Prefer maintained replacements for deprecated linters.
- Avoid introducing rule sets that require broad immediate refactors unless explicitly planned.
Verification Gate¶
Run all commands below after each maintenance change.
golangci-lint help linters --json > tmp/golangci-linters.json
golangci-lint config verify --config .golangci.yaml
git diff --check -- .golangci.yaml
Optional inspection:
jq -r '.[].name' tmp/golangci-linters.json | sort
Completion criteria:
golangci-lint config verifypasses.- No
git diff --checkerrors. - Markers are applied only to changed lines.
linters.settingsordering is preserved.
Operational Notes¶
- Re-run this workflow whenever golangci-lint version changes.
- Treat this file as policy; project-specific enable/disable decisions belong in PR descriptions or issue discussions.
- Reviewer/instructions boundary rule is defined in linter-review-boundary.md.