aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/Makefile
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-03-17 08:43:23 +0100
committerGitHub <noreply@github.com>2022-03-17 08:43:23 +0100
commitedc0babf926099386675b7dac4131c4a35aeaec5 (patch)
tree221465cd61d2261571edd523542b6e38896ea636 /client/go/Makefile
parent7c1698de2336cdc39b45d2e61001576b1fdcaaaa (diff)
parent9a6bfd4ab893cf1ed4c8c1141e4bcad3829decad (diff)
Merge pull request #21710 from vespa-engine/mpolden/cleanup
Stop using deprecated ioutil functions
Diffstat (limited to 'client/go/Makefile')
-rw-r--r--client/go/Makefile33
1 files changed, 14 insertions, 19 deletions
diff --git a/client/go/Makefile b/client/go/Makefile
index 3da7b504f6c..b088612abb2 100644
--- a/client/go/Makefile
+++ b/client/go/Makefile
@@ -8,21 +8,13 @@ ifeq ($(VERSION),)
VERSION = $(DEVEL_VERSION)
endif
-BIN ?= $(CURDIR)/bin
-SHARE ?= $(CURDIR)/share
+PREFIX ?= $(CURDIR)
DIST ?= $(CURDIR)/dist
GO_FLAGS := -ldflags "-X github.com/vespa-engine/vespa/client/go/build.Version=$(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 +75,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,24 +101,27 @@ 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=$(PREFIX)/bin go install $(GO_FLAGS) ./...
manpages: install
- mkdir -p $(SHARE)/man/man1
- $(BIN)/vespa man $(SHARE)/man/man1
+ mkdir -p $(PREFIX)/share/man/man1
+ $(PREFIX)/bin/vespa man $(PREFIX)/share/man/man1
clean:
rm -rf $(DIST)
- rm -f $(BIN)/vespa $(SHARE)/man/man1/vespa.1 $(SHARE)/man/man1/vespa-*.1
- rmdir -p $(BIN) &> /dev/null || true
- rmdir -p $(SHARE)/man/man1 &> /dev/null || true
+ rm -f $(PREFIX)/bin/vespa $(PREFIX)/share/man/man1/vespa.1 $(PREFIX)/share/man/man1/vespa-*.1
+ rmdir -p $(PREFIX)/bin $(PREFIX)/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; }