Skip to content

Commit

Permalink
* added support for default GOPATH, which makes GNUmakefile more resi…
Browse files Browse the repository at this point in the history
…lient to build environments which do not use the GOPATH strategy (microsoft#349)

*  changed if statement for recipe check-vendor-vs-mod in GNUmakefile to make it compatible with WSL1 (Ubuntu 18.04) as well

Co-authored-by: Thomas Meckel <tmeckel@users.noreply.github.com>
  • Loading branch information
tmeckel and tmeckel authored Jun 1, 2020
1 parent fb54986 commit 1b28125
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ WEBSITE_REPO=github.com/hashicorp/terraform-website
PKG_NAME=azuredevops
TESTTIMEOUT=180m

ifeq ($(GOPATH),)
GOPATH:=$(shell go env GOPATH)
endif

.EXPORT_ALL_VARIABLES:
TF_SCHEMA_PANIC_ON_ERROR=1
GO111MODULE=on
Expand All @@ -13,11 +17,11 @@ default: build
tools:
@echo "==> installing required tooling..."
@sh "$(CURDIR)/scripts/gogetcookie.sh"
@echo $$GOPATH
@echo "GOPATH: $(GOPATH)"
GO111MODULE=off go get -u github.com/client9/misspell/cmd/misspell
GO111MODULE=off go get -u github.com/bflad/tfproviderlint/cmd/tfproviderlint
GO111MODULE=off go get -u github.com/bflad/tfproviderdocs
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.27.0
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(GOPATH)/bin" v1.27.0

build: fmtcheck check-vendor-vs-mod
go install
Expand All @@ -32,7 +36,7 @@ fmtcheck:

lint:
@echo "==> Checking source code against linters..."
$$GOPATH/bin/golangci-lint run ./...
$(GOPATH)/bin/golangci-lint run ./...

test: fmtcheck
go test -tags "all" -i $(TEST) || exit 1
Expand All @@ -53,9 +57,9 @@ test-compile:
check-vendor-vs-mod: ## Check that go modules and vendored code are on par
@echo "==> Checking that go modules and vendored dependencies match..."
go mod vendor
@if [[ `git status --porcelain vendor` ]]; then \
echo "ERROR: vendor dir is not on par with go modules definition." && \
exit 1; \
@if [ "$$(git status --porcelain vendor)" != "" ]; then \
echo "ERROR: vendor dir is not on par with go modules definition."; \
exit 1; \
fi

vet:
Expand Down

0 comments on commit 1b28125

Please sign in to comment.