System-level Go tooling hooks that delegate to existing Make targets in HyperFleet repositories.
HyperFleet Go repositories use bingo to pin development tool versions (see dependency pinning standard). Rather than reimplementing bingo resolution, these hooks use language: system and delegate to the consuming repo's existing Make targets, which already handle tool resolution via bingo.
Runs make lint in the consuming repository.
- Stage:
pre-commit - Entry:
make lint - Language:
system - File filtering: Triggered by Go file changes (does not pass individual filenames)
Runs make gofmt in the consuming repository.
- Stage:
pre-commit - Entry:
make gofmt - Language:
system - File filtering: Triggered by Go file changes (does not pass individual filenames)
Runs make go-vet in the consuming repository.
- Stage:
pre-commit - Entry:
make go-vet - Language:
system - File filtering: Triggered by Go file changes (does not pass individual filenames)
Add to your .pre-commit-config.yaml:
repos:
- repo: https://github.com/openshift-hyperfleet/hyperfleet-hooks
rev: main # Use latest release tag
hooks:
- id: hyperfleet-golangci-lint
- id: hyperfleet-gofmt
- id: hyperfleet-go-vetInstall the hooks:
pre-commit install --hook-type pre-commitYou don't need to enable all hooks. Pick the ones you need:
hooks:
# Just formatting and linting
- id: hyperfleet-gofmt
- id: hyperfleet-golangci-lintSince these hooks use language: system, the consuming repository must have the corresponding Make targets:
make lint— runs golangci-lint (typically via bingo)make gofmt— checks Go file formattingmake go-vet— runsgo vet ./...
These targets are already standard in HyperFleet repositories. Ensure bingo-managed tools are built:
make tools-installThe consuming repository is missing the required Make target. Ensure your Makefile includes the lint, gofmt, and go-vet targets.
If make lint fails because golangci-lint is not installed, build the bingo-managed tools:
make tools-install
# or
bingo getThese hooks run the exact same Make targets, so results should be identical. If they differ, check:
- The bingo binary exists:
ls .bingo/golangci-lint-* - The
.golangci.ymlconfig is present in your repo root - Pre-commit environment is not interfering (check
pre-commit run --verbose)
go vet catches issues that compile successfully but are likely bugs (e.g., unreachable code, incorrect format strings). Fix the reported issues rather than skipping the hook.