build: gate lint on gofmt and enforce it in CI#25
Conversation
`make lint` was go vet only, so unformatted code (which CI's go vet also misses) passed clean. Add a `fmt-check` target that fails if `gofmt -l` reports anything, make `lint` depend on it, and add a `fmt` target that writes gofmt fixes. Menu, help, and .PHONY kept in sync.
`make lint` was go vet only, so unformatted code (which CI's go vet also missed) passed clean everywhere. Close the gap: - Add a `fmt-check` target that fails if `gofmt -l` reports any file, make `lint` depend on it, and add a `fmt` target that writes gofmt fixes. - Point the CI workflow's lint step at `make lint` so the pipeline runs the same gofmt + vet gate as local. The Makefile is now the single source of truth; build/test stay explicit in CI (they keep -race and coverage). - Menu, help, and .PHONY kept in sync.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📜 Recent review details
|
| Layer / File(s) | Summary |
|---|---|
fmt/fmt-check targets and lint dependency Makefile |
New fmt target runs gofmt -w .; new fmt-check target fails if unformatted files exist; lint now depends on fmt-check before running go vet. |
Menu, help, and list updates Makefile |
Interactive menu adds Code Quality/Maintenance options 6-9 mapped to fmt, lint, clean, tidy; help text documents new commands; list added as alias to help; .PHONY updated. |
CI lint step .github/workflows/go.yml |
CI's standalone go vet ./... step is replaced with a "Lint (gofmt check + go vet)" step running make lint. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Possibly related PRs
- internetblacksmith/createpr#21: Both PRs modify
.github/workflows/go.ymllint/vet behavior in the CI workflow.
Poem
A rabbit hops through gofmt's gate,
Checking tabs before it's late,
make lintnow does it all,
fmt then vet, before the call,
Clean code hops, both big and small! 🐇✨
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately summarizes the main change: lint is gated on gofmt and the same check is enforced in CI. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Problem
make lintrango vetonly, and CI ran rawgo vettoo — so unformatted code (a stray trailing tab, etc.) passed both local lint and the pipeline.Change
fmt—gofmt -w .(fixer).fmt-check— fails (exit 1) ifgofmt -l .reports any file, printing the offenders + a "runmake fmt" hint. Reusable gate.lint: fmt-check— one command covers formatting and vet.make lintinstead of rawgo vet, so the pipeline enforces the same gofmt gate as local. The Makefile is now the single source of truth. Build/Test stay explicit in CI (they keep-raceand coverage)..PHONYkept in sync (new "Code Quality" group).Verified locally
make lintpasses on clean code.make lintfail (exit 2) with the offender listed — the gate bites.make fmtfixes it; build + tests unaffected.This time CI itself runs the gate, so the check is enforced, not just available.
Summary by CodeRabbit
New Features
Bug Fixes