From 7399e616d6f7d42c6f61afefb8786ce5939453b7 Mon Sep 17 00:00:00 2001 From: Jesse Hallam Date: Thu, 11 Jul 2019 17:21:51 -0300 Subject: [PATCH] avoid assuming $GOPATH is set (#55) Assign `$GOPATH` if not set, and use same to get to `$GOPATH/bin` instead of assuming `$PATH` contains same. --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c55d542..15ceaaf 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ GO ?= $(shell command -v go 2> /dev/null) NPM ?= $(shell command -v npm 2> /dev/null) CURL ?= $(shell command -v curl 2> /dev/null) MANIFEST_FILE ?= plugin.json +GOPATH ?= $(shell go env GOPATH) GO_TEST_FLAGS ?= -race GO_BUILD_FLAGS ?= MM_UTILITIES_DIR ?= ../mattermost-utilities @@ -63,7 +64,7 @@ endif govet: ifneq ($(HAS_SERVER),) @echo Running govet - @# Workaroung because you can't install binaries without adding them to go.mod + @# Workaround because you can't install binaries without adding them to go.mod env GO111MODULE=off $(GO) get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow $(GO) vet ./... $(GO) vet -vettool=$(GOPATH)/bin/shadow ./... @@ -75,7 +76,7 @@ endif golint: @echo Running lint env GO111MODULE=off $(GO) get golang.org/x/lint/golint - golint -set_exit_status ./... + $(GOPATH)/bin/golint -set_exit_status ./... @echo lint success ## Builds the server, if it exists, including support for multiple architectures.