Skip to content

Add pre-commit hook for gofmt/vet/build#44

Merged
marcus merged 2 commits intomainfrom
shrike/pre-commit-hooks
Mar 1, 2026
Merged

Add pre-commit hook for gofmt/vet/build#44
marcus merged 2 commits intomainfrom
shrike/pre-commit-hooks

Conversation

@marcus
Copy link
Owner

@marcus marcus commented Mar 1, 2026

What

Adds a lightweight git pre-commit hook for nightshift.

Files

  • scripts/pre-commit.sh — the hook script
  • Makefilemake install-hooks target (symlinks into .git/hooks/)
  • README.md — Development section with install instructions

Checks

Check Speed Why
gofmt ~instant Staged files only — flags unformatted Go
go vet ~1s Catches common correctness bugs
go build ~2s Ensures it compiles

Not included: go test (too slow per-commit) and golangci-lint (no local config yet — both still run in CI).

Install

make install-hooks

To bypass: git commit --no-verify

Tested

Hook ran on its own commit cleanly. Also verified it catches:

  • Unformatted staged files → exits 1 with file list
  • Build/vet failures → exits 1 with output

- scripts/pre-commit.sh: lightweight hook checking gofmt (staged files
  only), go vet, and go build; exits non-zero on any failure
- Makefile: add install-hooks target (symlinks hook into .git/hooks/)
- README: add Development section documenting make install-hooks

Skipped: go test (too slow per-commit), golangci-lint (no local config yet).
Both remain available via make check / CI.
On the first of the month, daily estimate = all requests / 1 day,
which can legitimately exceed the daily allocation. The assertion
was too strict; percentages > 100% are valid over-budget signals.
@marcus marcus merged commit 13720ae into main Mar 1, 2026
2 checks passed
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