From 0e92d190cc668da3337e6d62a726f442d06bdda0 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Thu, 25 Apr 2024 12:38:50 -0400 Subject: [PATCH] make: Add easy error message for common issue This can happen if the golang tools are angry. Make it easier for the user to debug and fix. --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 346e20b0..b8972000 100644 --- a/Makefile +++ b/Makefile @@ -225,6 +225,8 @@ build-debug: $(PROGRAM) GOOS=$(firstword $(subst -, ,$*)) GOARCH=$(lastword $(subst -, ,$*)) build/mgmt-%: $(GO_FILES) $(MCL_FILES) go.mod go.sum | lang funcgen + @# If you need to run `go mod tidy` then this can trigger. + @if [ "$(PKGNAME)" = "" ]; then echo "\$$(PKGNAME) is empty, test with: go list ."; exit 42; fi @echo "Building: $(PROGRAM), os/arch: $*, version: $(SVERSION)..." time env GOOS=${GOOS} GOARCH=${GOARCH} go build $(TRIMPATH) -ldflags=$(PKGNAME)="-X main.program=$(PROGRAM) -X main.version=$(SVERSION) ${LDFLAGS}" -o $@ $(BUILD_FLAGS)