Pre-commit checks
Run these in order from the repo root before every commit. Stop and report if any step fails.
gofmt — format changed Go files:
gofmt -l $(git diff --name-only --diff-filter=ACM HEAD | grep '\.go$')If output is non-empty, run
gofmt -won those files.goimports — organize imports:
goimports -l $(git diff --name-only --diff-filter=ACM HEAD | grep '\.go$')If output is non-empty, run
goimports -won those files.Gazelle — sync
deps.bzl(whengo.modchanged):bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%prysm_deps -prune=true git diff --exit-code deps.bzlGazelle — sync
BUILD.bazel:bazel run //:gazelle -- fix --mode=diffIf the diff is non-empty, run
bazel run //:gazelle -- fix.Regenerate code (when
.proto, SSZ-tagged structs, or proto service interfaces changed):make genRegenerates proto/ssz/mocks and runs goimports+gofmt on the generated files. It's cached; if unsure which files changed, bypass the cache with
make gen mode=force. Limit to one kind with e.g.make gen proto.Build smoke check:
make buildmake buildrunsgenfirst, then builds all binaries.
Report
- Success: "✅ All pre-checks passed. Ready to commit."
- Failure: name the failed check and the fix command.