Backport Make it possible to skip the go generate part of the build. into ce/main (#14245)

This commit is contained in:
Vault Automation 2026-04-24 07:41:32 -04:00 committed by GitHub
parent 6c198ac93b
commit ce18ef35a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -170,18 +170,24 @@ protolint: prep check-tools-external
@echo "==> Linting protobufs..."
@buf lint
# prep runs `go generate` to build the dynamically generated
# source files.
# prep runs `go generate` to build the dynamically generated source files.
# Since generated files are committed to git, this is usually not needed.
# Set SKIP_GEN=1 to skip generation (for savvy users who know they don't need it).
#
# n.b.: prep used to depend on fmtcheck, but since fmtcheck is
# now run as a pre-commit hook (and there's little value in
# making every build run the formatter), we've removed that
# dependency.
prep: check-go-version clean
@echo "==> Running go generate..."
@GOARCH= GOOS= $(GO_CMD) generate $(MAIN_PACKAGES)
@GOARCH= GOOS= cd api && $(GO_CMD) generate $(API_PACKAGES)
@GOARCH= GOOS= cd sdk && $(GO_CMD) generate $(SDK_PACKAGES)
prep: check-go-version
@if [ "$(SKIP_GEN)" = "1" ]; then \
echo "==> Skipping go generate (SKIP_GEN=1)"; \
else \
$(MAKE) clean; \
echo "==> Running go generate..."; \
GOARCH= GOOS= $(GO_CMD) generate $(MAIN_PACKAGES); \
(cd api && GOARCH= GOOS= $(GO_CMD) generate $(API_PACKAGES)); \
(cd sdk && GOARCH= GOOS= $(GO_CMD) generate $(SDK_PACKAGES)); \
fi
# Git doesn't allow us to store shared hooks in .git. Instead, we make sure they're up-to-date
# whenever a make target is invoked.