aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/Makefile
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-03-14 14:38:50 +0100
committerMartin Polden <mpolden@mpolden.no>2022-03-16 15:14:59 +0100
commit200855753d77a95129f249c187b58e73423ed597 (patch)
treedbeca038c54d50146c7fd9b1681e21888dff209b /client/go/Makefile
parent89c00be86b2de199ab125d0bc662e6b429dc662d (diff)
Only override GOPROXY in CI
Diffstat (limited to 'client/go/Makefile')
-rw-r--r--client/go/Makefile21
1 files changed, 9 insertions, 12 deletions
diff --git a/client/go/Makefile b/client/go/Makefile
index 3da7b504f6c..8bcb4cba376 100644
--- a/client/go/Makefile
+++ b/client/go/Makefile
@@ -16,13 +16,6 @@ GO_FLAGS := -ldflags "-X github.com/vespa-engine/vespa/client/go/build.Version=$
GIT_ROOT := $(shell git rev-parse --show-toplevel)
DIST_TARGETS := dist-mac dist-mac-arm64 dist-linux dist-linux-arm64 dist-win32 dist-win64
-GOPROXY_OVERRIDE :=
-ifndef GOPROXY
-ifeq ($(shell go env GOPROXY),direct)
-GOPROXY_OVERRIDE := GOPROXY=https://proxy.golang.org,direct
-endif
-endif
-
all: test checkfmt install
#
@@ -83,7 +76,7 @@ dist-win64: GOOS=windows
dist-win64: GOARCH=amd64
$(DIST_TARGETS): DIST_NAME=vespa-cli_$(VERSION)_$(GOOS)_$(GOARCH)
-$(DIST_TARGETS): dist-version manpages
+$(DIST_TARGETS): dist-version ci manpages
$(DIST_TARGETS):
mkdir -p $(DIST)/$(DIST_NAME)/bin
env GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOPROXY_OVERRIDE) go build -o $(DIST)/$(DIST_NAME)/bin $(GO_FLAGS) ./...
@@ -109,11 +102,15 @@ install-all: all manpages
# Development targets
#
-install:
+ci:
ifdef CI
+# Ensure that CI systems use a proxy for downloading dependencies
+ go env -w GOPROXY="https://proxy.golang.org,direct"
go env
endif
- env GOBIN=$(BIN) $(GOPROXY_OVERRIDE) go install $(GO_FLAGS) ./...
+
+install: ci
+ env GOBIN=$(BIN) go install $(GO_FLAGS) ./...
manpages: install
mkdir -p $(SHARE)/man/man1
@@ -125,8 +122,8 @@ clean:
rmdir -p $(BIN) &> /dev/null || true
rmdir -p $(SHARE)/man/man1 &> /dev/null || true
-test:
- env $(GOPROXY_OVERRIDE) go test ./...
+test: ci
+ go test ./...
checkfmt:
@bash -c "diff --line-format='%L' <(echo -n) <(gofmt -l .)" || { echo "one or more files need to be formatted: try make fmt to fix this automatically"; exit 1; }