1
0

Added a bootstrap target in the makefile to download required tools and updated the README.md instructions

This commit is contained in:
Jim Alateras 2015-06-01 09:32:36 +10:00
parent d4ebde3504
commit 21baf6dc95
3 changed files with 18 additions and 12 deletions

1
.gitignore vendored
View File

@ -45,4 +45,5 @@ Vagrantfile
*.hcl
.DS_Store
.idea

View File

@ -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

View File

@ -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
...
```