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.
This commit is contained in:
Martin Atkins 2017-08-25 16:21:06 -07:00
parent 62d154b9f9
commit 8cf6756ab7
1 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
TEST?=$$(go list ./... | grep -v '/terraform/vendor/' | grep -v '/builtin/bins/') TEST?=./...
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
default: test vet default: test vet
@ -27,10 +27,11 @@ plugin-dev: generate
mv $(GOPATH)/bin/$(PLUGIN) $(GOPATH)/bin/terraform-$(PLUGIN) mv $(GOPATH)/bin/$(PLUGIN) $(GOPATH)/bin/terraform-$(PLUGIN)
# test runs the unit tests # 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 test: fmtcheck generate
go test -i $(TEST) || exit 1 go test -i $(TEST) || exit 1
echo $(TEST) | \ go list $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=60s -parallel=4
xargs -t -n4 go test $(TESTARGS) -timeout=60s -parallel=4
# testacc runs acceptance tests # testacc runs acceptance tests
testacc: fmtcheck generate testacc: fmtcheck generate
@ -64,8 +65,8 @@ cover:
# vet runs the Go source code static analysis tool `vet` to find # vet runs the Go source code static analysis tool `vet` to find
# any common errors. # any common errors.
vet: vet:
@echo 'go vet $$(go list ./... | grep -v /terraform/vendor/)' @echo 'go vet ./...'
@go vet $$(go list ./... | grep -v /terraform/vendor/) ; if [ $$? -eq 1 ]; then \ @go vet ./... ; if [ $$? -eq 1 ]; then \
echo ""; \ echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \ echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for review."; \ 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 \ @which stringer > /dev/null; if [ $$? -ne 0 ]; then \
go get -u golang.org/x/tools/cmd/stringer; \ go get -u golang.org/x/tools/cmd/stringer; \
fi fi
go generate $$(go list ./... | grep -v /terraform/vendor/) go generate ./...
@go fmt command/internal_plugin_list.go > /dev/null @go fmt command/internal_plugin_list.go > /dev/null
fmt: fmt: