Stop assuming that GOPATH is always set, and is a single directory
As of I think go1.8 GOPATH is by default $HOME/go so it is incorrect to
assume that it is set.
If not set, then the Makefile assumes gometalinter will be in
/bin/gometalinter, which it likely is not, and thus fails.
We could change configure to set GOPATH in the .env, however then we
would be assuming that GOPATH is a single entry - whereas like other
paths, it can contain more than one value.
So instead this commit stops trying to install gometalinter, and like
dep, it assumes that it is installed prior.
(and since the current behaviour of the Makefile is affecting state
external to the project, that seems more logical)
commitb05eb71adf77e3e2c879316316bd405587997e85
authorAdam Eijdenberg <adam.eijdenberg@digital.gov.au>
dateMon 3 Jun 2019, 17:25 (7 years ago)
parent0d56a4c
Makefile+1−8
@@ -15,15 +15,8 @@ clean:
1515distclean: clean
1616 rm -rf vendor
1717
18−BIN_DIR := $(GOPATH)/bin
19−GOMETALINTER := $(BIN_DIR)/gometalinter
20−
21−$(GOMETALINTER):
22− $(GO) get -u github.com/alecthomas/gometalinter
23− gometalinter --install %> /dev/null
24−
2518.PHONY: lint
26−lint: $(GOMETALINTER)
19+lint:
2720 $(GOMETALINTER) --vendor --disable-all \
2821 --enable=vet \
2922 --enable=vetshadow \
configure+2
@@ -126,6 +126,7 @@ check_for go
126126check_go_version
127127check_go_env
128128check_for dep
129+check_for gometalinter
129130
130131echo
131132
@@ -134,6 +135,7 @@ cat <<- EOF > .env
134135 GO := "${tools[go]}"
135136 GO_VERSION := ${tools[go_version]}
136137 DEP := "${tools[dep]}"
138+ GOMETALINTER := "${tools[gometalinter]}"
137139EOF
138140
139141echo "Environment configuration written to .env"