diff --git a/Makefile b/Makefile index 0c1f6ea13..fde469c9c 100644 --- a/Makefile +++ b/Makefile @@ -3,16 +3,21 @@ VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf default: test +# bin generates the releaseable binaries for Terraform bin: generate @sh -c "'$(CURDIR)/scripts/build.sh'" +# dev creates binaries for testing Terraform locally. These are put +# into ./bin/ as well as $GOPATH/bin dev: generate @TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'" +# test runs the unit tests and vets the code test: generate TF_ACC= go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4 @$(MAKE) vet +# testacc runs acceptance tests testacc: generate @if [ "$(TEST)" = "./..." ]; then \ echo "ERROR: Set TEST to a specific package"; \ @@ -20,9 +25,12 @@ testacc: generate fi TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 45m +# testrace runs the race checker testrace: generate TF_ACC= go test -race $(TEST) $(TESTARGS) +# updatedeps installs all the dependencies that Terraform needs to run +# and build. updatedeps: $(eval REF := $(shell sh -c "\ git symbolic-ref --short HEAD 2>/dev/null \ @@ -33,6 +41,8 @@ updatedeps: go get -f -u -v ./... git checkout $(REF) +# vet runs the Go source code static analysis tool `vet` to find +# any common errors. vet: @go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \ go get golang.org/x/tools/cmd/vet; \ @@ -44,6 +54,8 @@ vet: echo "and fix them if necessary before submitting the code for reviewal."; \ fi +# generate runs `go generate` to build the dynamically generated +# source files. generate: go generate ./...