From 8cf6756ab7ed8ec43d29a49c30af9b1d210fe897 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Fri, 25 Aug 2017 16:21:06 -0700 Subject: [PATCH] build: Remove vendor-grepping from Makefile As of Go 1.9, ./... excludes the vendor directory by default and so we no longer need to jump through hoops to exclude vendored packages from testing, vetting, etc. As a simplification this also re-introduces builtin/bins to the set of packages we run tests on. With the providers now split into their own repositories there's far fewer of these and so including them doesn't really hurt anything, and makes our invocations here simpler. --- Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c51b77e1d..e5ca1dfba 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -TEST?=$$(go list ./... | grep -v '/terraform/vendor/' | grep -v '/builtin/bins/') +TEST?=./... GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) default: test vet @@ -27,10 +27,11 @@ plugin-dev: generate mv $(GOPATH)/bin/$(PLUGIN) $(GOPATH)/bin/terraform-$(PLUGIN) # test runs the unit tests +# we run this one package at a time here because running the entire suite in +# one command creates memory usage issues when running in Travis-CI. test: fmtcheck generate go test -i $(TEST) || exit 1 - echo $(TEST) | \ - xargs -t -n4 go test $(TESTARGS) -timeout=60s -parallel=4 + go list $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=60s -parallel=4 # testacc runs acceptance tests testacc: fmtcheck generate @@ -64,8 +65,8 @@ cover: # vet runs the Go source code static analysis tool `vet` to find # any common errors. vet: - @echo 'go vet $$(go list ./... | grep -v /terraform/vendor/)' - @go vet $$(go list ./... | grep -v /terraform/vendor/) ; if [ $$? -eq 1 ]; then \ + @echo 'go vet ./...' + @go vet ./... ; if [ $$? -eq 1 ]; then \ echo ""; \ echo "Vet found suspicious constructs. Please check the reported constructs"; \ echo "and fix them if necessary before submitting the code for review."; \ @@ -78,7 +79,7 @@ generate: @which stringer > /dev/null; if [ $$? -ne 0 ]; then \ go get -u golang.org/x/tools/cmd/stringer; \ fi - go generate $$(go list ./... | grep -v /terraform/vendor/) + go generate ./... @go fmt command/internal_plugin_list.go > /dev/null fmt: