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)
This commit is contained in:
Adam Eijdenberg 2019-06-03 17:25:48 +10:00
parent 0d56a4c570
commit b05eb71adf
2 changed files with 3 additions and 8 deletions

View File

@ -15,15 +15,8 @@ clean:
distclean: clean
rm -rf vendor
BIN_DIR := $(GOPATH)/bin
GOMETALINTER := $(BIN_DIR)/gometalinter
$(GOMETALINTER):
$(GO) get -u github.com/alecthomas/gometalinter
gometalinter --install %> /dev/null
.PHONY: lint
lint: $(GOMETALINTER)
lint:
$(GOMETALINTER) --vendor --disable-all \
--enable=vet \
--enable=vetshadow \

2
configure vendored
View File

@ -126,6 +126,7 @@ check_for go
check_go_version
check_go_env
check_for dep
check_for gometalinter
echo
@ -134,6 +135,7 @@ cat <<- EOF > .env
GO := "${tools[go]}"
GO_VERSION := ${tools[go_version]}
DEP := "${tools[dep]}"
GOMETALINTER := "${tools[gometalinter]}"
EOF
echo "Environment configuration written to .env"