aboutsummaryrefslogtreecommitdiffstats
path: root/client/go
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2023-05-11 12:20:41 +0200
committerMartin Polden <mpolden@mpolden.no>2023-05-11 12:26:15 +0200
commit7dd81612168d7958f45da66ac39b0570811a5d0d (patch)
tree274968940b4b9215eccb5b16376939e66280501a /client/go
parent5693b9621d9882f0e9a66c7d6441b898cb43f6d9 (diff)
Find project root without git
Diffstat (limited to 'client/go')
-rw-r--r--client/go/Makefile9
1 files changed, 6 insertions, 3 deletions
diff --git a/client/go/Makefile b/client/go/Makefile
index 9ad8a749fce..72acf5896e7 100644
--- a/client/go/Makefile
+++ b/client/go/Makefile
@@ -14,8 +14,8 @@ SHARE ?= $(PREFIX)/share
DIST ?= $(CURDIR)/dist
GO_FLAGS := -ldflags "-X github.com/vespa-engine/vespa/client/go/internal/build.Version=$(VERSION)"
-GIT_ROOT := $(shell git rev-parse --show-toplevel)
-GO_TMPDIR := $(GIT_ROOT)/build/go
+PROJECT_ROOT := $(shell realpath $(CURDIR)/../..)
+GO_TMPDIR := $(PROJECT_ROOT)/build/go
DIST_TARGETS := dist-mac dist-mac-arm64 dist-linux dist-linux-arm64 dist-win32 dist-win64
all: test checkfmt install
@@ -87,7 +87,7 @@ $(DIST_TARGETS): dist-version ci manpages
$(DIST_TARGETS):
mkdir -p $(DIST)/$(DIST_NAME)/bin
env CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(DIST)/$(DIST_NAME)/bin $(GO_FLAGS) ./...
- cp -a $(GIT_ROOT)/LICENSE $(DIST)/$(DIST_NAME)
+ cp -a $(PROJECT_ROOT)/LICENSE $(DIST)/$(DIST_NAME)
if [ "$(GOOS)" = "windows" ]; then \
cd $(DIST) && zip -r $(DIST)/$(DIST_NAME).zip $(DIST_NAME); \
else \
@@ -132,6 +132,9 @@ clean:
rmdir -p $(BIN) $(SHARE)/man/man1 > /dev/null 2>&1 || true
test: ci
+# Why custom GOTMPDIR? go builds executables for unit tests and by default these
+# end up in TMPDIR/GOTMPDIR. In some environments /tmp is mounted noexec so
+# running test executables will fail
mkdir -p $(GO_TMPDIR) && GOTMPDIR=$(GO_TMPDIR) go test ./...
checkfmt: