2014-09-02 18:13:55 -04:00
|
|
|
TEST?=./...
|
2015-01-30 07:03:25 -05:00
|
|
|
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
|
|
|
|
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
|
2013-05-07 14:39:32 -04:00
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
default: test
|
2013-03-23 03:48:20 -04:00
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
bin:
|
|
|
|
@sh -c "$(CURDIR)/scripts/build.sh"
|
2013-09-17 07:35:07 -04:00
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
dev:
|
|
|
|
@TF_DEV=1 sh -c "$(CURDIR)/scripts/build.sh"
|
2013-08-13 21:42:08 -04:00
|
|
|
|
2015-05-26 16:26:22 -04:00
|
|
|
# generate runs `go generate` to build the dynamically generated
|
|
|
|
# source files.
|
|
|
|
generate:
|
|
|
|
go generate ./...
|
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
test:
|
|
|
|
go test $(TEST) $(TESTARGS) -timeout=10s
|
2015-01-30 07:03:25 -05:00
|
|
|
@$(MAKE) vet
|
2013-07-18 10:26:36 -04:00
|
|
|
|
2015-05-26 16:26:22 -04:00
|
|
|
# testacc runs acceptance tests
|
|
|
|
testacc: generate
|
|
|
|
@if [ "$(TEST)" = "./..." ]; then \
|
|
|
|
echo "ERROR: Set TEST to a specific package"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
PACKER_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 45m
|
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
testrace:
|
|
|
|
go test -race $(TEST) $(TESTARGS)
|
2013-03-24 17:47:59 -04:00
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
updatedeps:
|
2015-06-15 16:50:01 -04:00
|
|
|
go get -u github.com/mitchellh/gox
|
|
|
|
go get -u golang.org/x/tools/cmd/stringer
|
|
|
|
go list ./... \
|
|
|
|
| xargs go list -f '{{join .Deps "\n"}}' \
|
|
|
|
| grep -v github.com/mitchellh/packer \
|
|
|
|
| sort -u \
|
|
|
|
| xargs go get -f -u -v
|
2013-03-24 17:31:18 -04:00
|
|
|
|
2015-01-30 07:03:25 -05:00
|
|
|
vet:
|
|
|
|
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
|
|
|
|
go get golang.org/x/tools/cmd/vet; \
|
|
|
|
fi
|
|
|
|
@go tool vet $(VETARGS) . ; 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 reviewal."; \
|
2015-06-01 18:40:43 -04:00
|
|
|
exit 1; \
|
2015-01-30 07:03:25 -05:00
|
|
|
fi
|
|
|
|
|
2015-05-26 16:26:22 -04:00
|
|
|
.PHONY: bin default generate test testacc updatedeps vet
|