From 21baf6dc9531cee11f596b342c61e2dad5a7e3da Mon Sep 17 00:00:00 2001 From: Jim Alateras Date: Mon, 1 Jun 2015 09:32:36 +1000 Subject: [PATCH] Added a bootstrap target in the makefile to download required tools and updated the README.md instructions --- .gitignore | 1 + Makefile | 20 +++++++++++++------- README.md | 9 ++++----- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 792dcca12c..36feedb44d 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,5 @@ Vagrantfile *.hcl .DS_Store +.idea diff --git a/Makefile b/Makefile index 47ff0b32f0..ac3526ac91 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,10 @@ TEST?=./... VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr +EXTERNAL_TOOLS=\ + github.com/tools/godep \ + github.com/mitchellh/gox \ + golang.org/x/tools/cmd/cover \ + golang.org/x/tools/cmd/vet default: test @@ -29,17 +34,11 @@ testrace: generate TF_ACC= godep go test -race $(TEST) $(TESTARGS) cover: - @go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \ - go get -u golang.org/x/tools/cmd/cover; \ - fi ./scripts/coverage.sh --html # 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; \ - fi @go list -f '{{.Dir}}' ./... \ | grep -v '.*github.com/hashicorp/vault$$' \ | xargs go tool vet ; if [ $$? -eq 1 ]; then \ @@ -53,4 +52,11 @@ vet: generate: go generate ./... -.PHONY: bin default generate test vet +# bootstrap the build by downloading additional tools +bootstrap: + @for tool in $(EXTERNAL_TOOLS) ; do \ + echo "Installing $$tool" ; \ + go get $$tool; \ + done + +.PHONY: bin default generate test vet bootstrap diff --git a/README.md b/README.md index 7116dcea56..cdbbf1e806 100644 --- a/README.md +++ b/README.md @@ -57,13 +57,12 @@ you'll first need [Go](https://www.golang.org) installed on your machine (version 1.4+ is *required*). For local dev first make sure Go is properly installed, including setting up a -[GOPATH](https://golang.org/doc/code.html#GOPATH). After setting up Go, -install Godeps, a tool we use for vendoring dependencies and Gox, a simple cross -compilation tool: +[GOPATH](https://golang.org/doc/code.html#GOPATH). After setting up Go, you can +downlaod the required build tools such as vet, cover, godep etc by bootstrapping +your environment. ```sh -$ go get github.com/tools/godep -$ go get github.com/mitchellh/gox +$ make bootstrap ... ```