Skip to content

build: gate lint on gofmt and enforce it in CI#25

Merged
jabawack81 merged 2 commits into
mainfrom
chore/makefile-fmt-lint
Jul 4, 2026
Merged

build: gate lint on gofmt and enforce it in CI#25
jabawack81 merged 2 commits into
mainfrom
chore/makefile-fmt-lint

Conversation

@jabawack81

@jabawack81 jabawack81 commented Jul 4, 2026

Copy link
Copy Markdown
Member

Problem

make lint ran go vet only, and CI ran raw go vet too — so unformatted code (a stray trailing tab, etc.) passed both local lint and the pipeline.

Change

  • fmtgofmt -w . (fixer).
  • fmt-check — fails (exit 1) if gofmt -l . reports any file, printing the offenders + a "run make fmt" hint. Reusable gate.
  • lint: fmt-check — one command covers formatting and vet.
  • CI runs make lint instead of raw go 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 -race and coverage).
  • Menu / help / .PHONY kept in sync (new "Code Quality" group).

Verified locally

  • make lint passes on clean code.
  • Injecting bad formatting makes make lint fail (exit 2) with the offender listed — the gate bites.
  • make fmt fixes it; build + tests unaffected.

This time CI itself runs the gate, so the check is enforced, not just available.

Summary by CodeRabbit

  • New Features

    • Added new formatting commands to make it easier to keep Go code standardized.
    • Added a new help/list view and updated the menu options to include the latest quality-related commands.
  • Bug Fixes

    • The lint workflow now checks formatting before running Go vet, helping catch style issues earlier.
    • CI linting now uses the combined quality check instead of only running vet.

`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.
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4e7c39bc-a544-4704-9224-6b1a64bd48ad

📥 Commits

Reviewing files that changed from the base of the PR and between aa12731 and 9a4764e.

📒 Files selected for processing (2)
  • .github/workflows/go.yml
  • Makefile
📜 Recent review details
⚠️ CI failures not shown inline (2)

GitHub Actions: Go Build & Test / 0_build.txt: build: gate lint on gofmt and enforce it in CI

Conclusion: failure

View job details

/comparator.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/utils/sort.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/containers/enumerable.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/containers/iterator.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/containers/serialization.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/containers/containers_test.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/containers/containers.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/trees/btree/btree.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/trees/btree/iterator.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/trees/btree/serialization.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/trees/btree/btree_test.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/trees/trees.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/trees/binaryheap/binaryheap.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/trees/binaryheap/iterator.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/trees/binaryheap/binaryheap_test.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/trees/binaryheap/serialization.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/emirpasic/gods@v1.18.1/trees/avltree/avltree_test.go: Cannot open: File exists
 /usr/bin/tar: ....

GitHub Actions: Go Build & Test / build: build: gate lint on gofmt and enforce it in CI

Conclusion: failure

View job details

exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/Dockerfile.arm: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/README.md: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/Makefile: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/.entire/settings.json: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/sha1cdblock_noasm.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/sha1cdblock_amd64.s: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/LICENSE: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/test/native_test.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/test/testdata/files/valid-file.txt: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/test/testdata/files/sha-mbles-2.bin: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/test/testdata/files/shattered-1.pdf: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/test/testdata/files/shattered-2.pdf: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/test/testdata/files/sha-mbles-1.bin: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/test/fuzz_test.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/test/shattered1_m1s.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/go.sum: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0.6.0/detection.go: Cannot open: File exists
 /usr/bin/tar: ../../../go/pkg/mod/github.com/pjbgf/sha1cd@v0...
🧰 Additional context used
📓 Path-based instructions (1)
Makefile

📄 CodeRabbit inference engine (CLAUDE.md)

Keep Makefile updated - add new tasks as project evolves

Files:

  • Makefile
🔇 Additional comments (4)
Makefile (3)

28-35: LGTM!

Also applies to: 44-47


95-104: LGTM!

Help/list/.PHONY updates stay in sync with the new fmt/fmt-check targets, satisfying the guideline to keep the Makefile updated as new tasks are added.


66-76: 📐 Maintainability & Code Quality

No vendor exclusion needed The repo has no vendor/ directory, so gofmt -w . and gofmt -l . won’t touch vendored code here.

			> Likely an incorrect or invalid review comment.
.github/workflows/go.yml (1)

38-39: LGTM!


📝 Walkthrough

Walkthrough

The Makefile adds fmt and fmt-check targets, makes lint depend on fmt-check, updates menu/help text and dispatch logic, and adds a list alias. The CI workflow's Go vet step is replaced with a make lint step.

Changes

Makefile Lint and Formatting Workflow

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

Poem

A rabbit hops through gofmt's gate,
Checking tabs before it's late,
make lint now 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jabawack81 jabawack81 added this pull request to the merge queue Jul 4, 2026
Merged via the queue into main with commit dab546d Jul 4, 2026
2 checks passed
@jabawack81 jabawack81 deleted the chore/makefile-fmt-lint branch July 4, 2026 23:12
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