Skip to content

chore: add make check and drive the CI lint gate from it - #15

Merged
KristofferRisa merged 1 commit into
mainfrom
chore/make-check
Aug 25, 2026
Merged

chore: add make check and drive the CI lint gate from it#15
KristofferRisa merged 1 commit into
mainfrom
chore/make-check

Conversation

@KristofferRisa

Copy link
Copy Markdown
Owner

Goal

Make the CI lint gate reproducible locally, so a contributor can tell whether their branch will pass before they push.

PR #12 shipped a gofmt -s violation through a full review cycle. The reason wasn't carelessness — nothing they could run locally reproduced the gate:

  • make fmt ran plain go fmt, which does not apply -s. The target named "fmt" did not satisfy the gate named "Check formatting".
  • The gate itself only existed inside test.yml, so the only way to run it was to push and wait.
  • Fork PRs from new contributors need manual Actions approval, so pushing and waiting returned nothing either. All 16 runs on feat: implement consumption history command #12 sat in action_required.

CONTRIBUTING.md documented the make fmt trap in prose. That wasn't enough — the fix is to remove the trap, not describe it.

Changes

make check runs every gate the lint job enforces:

check: check-fmt vet mod-verify test-race

The workflow now calls those targets instead of duplicating the commands inline, so the Makefile and CI cannot drift:

- name: Check formatting
  run: make check-fmt
- name: Run go vet
  run: make vet
- name: Run go mod verify
  run: make mod-verify

make fmt now runs gofmt -s -w . — it fixes exactly what check-fmt checks.

.PHONY was missing fmt, lint, tidy and the per-platform build targets. All listed now.

Docs: the pre-PR checklist in CONTRIBUTING.md collapses to a single make check, and the paragraph explaining the make fmt trap is deleted because the trap is gone. Added a note that CI runners are UTC, so timestamp tests must pin their zone — #12 also shipped a test asserting against t.Local(), which passed in CI and failed from UTC+11 east.

The test job is unchanged: it needs the coverage flags and the OS matrix, so it stays inline.

Verification

  • make check passes.
  • make check-fmt fails as expected on deliberately unformatted input, naming the file and pointing at make fmt; make fmt then clears it. This is the gate that silently passed before.
  • TZ=Pacific/Auckland go test ./... passes.

Not in this PR

Enabling Actions for outside contributors is a repo setting, not code — Settings → Actions → General → "Fork pull request workflows from outside collaborators". Until that changes, first-time contributors still get zero CI feedback, which was the larger half of what went wrong on #12.

Tasks

  • Add make check running the CI gates
  • Fix make fmt to apply -s
  • Point the workflow's lint job at the Makefile targets
  • Update CONTRIBUTING.md and CLAUDE.md
  • Change the fork-PR Actions approval setting (manual, repo settings)

Relates to #12

⚡ Built on gilfoyle with Claude Code

PR #12 shipped a formatting error that CI would have caught, because
nothing a contributor could run locally reproduced the CI gate:

- `make fmt` ran plain `go fmt`, which does not apply `-s`. The target named
  "fmt" therefore did not satisfy the format gate named "Check formatting".
- The gate itself lived only in the workflow YAML, so there was no way to
  run it short of pushing and waiting.

Adds `make check`, which runs every gate the lint job enforces:
check-fmt, vet, mod-verify and test-race. The workflow now calls those same
targets instead of duplicating the commands, so the two cannot drift.

Also:
- `make fmt` now runs `gofmt -s -w .`, so it fixes exactly what check-fmt
  checks.
- `.PHONY` was missing most targets; all of them are listed now.
- CONTRIBUTING.md's pre-PR checklist collapses to `make check`, and the
  note explaining the old `make fmt` trap is gone because the trap is gone.
- CONTRIBUTING.md gains a note that CI runners are UTC, so timestamp tests
  must pin their zone. #12 shipped a test that asserted against
  `t.Local()` and so passed in CI while failing from UTC+11 east.

Verified: `make check` passes; `make check-fmt` fails as expected on
deliberately unformatted input and `make fmt` clears it.
@KristofferRisa
KristofferRisa merged commit 271e4d3 into main Aug 25, 2026
5 checks passed
@KristofferRisa
KristofferRisa deleted the chore/make-check branch August 25, 2026 20:08
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