forked from hashicorp/packer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (43 loc) · 1.3 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
TEST?=./...
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
default: test
bin:
@sh -c "$(CURDIR)/scripts/build.sh"
dev:
@TF_DEV=1 sh -c "$(CURDIR)/scripts/build.sh"
# generate runs `go generate` to build the dynamically generated
# source files.
generate:
go generate ./...
test:
go test $(TEST) $(TESTARGS) -timeout=10s
@$(MAKE) vet
# 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
testrace:
go test -race $(TEST) $(TESTARGS)
updatedeps:
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
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."; \
exit 1; \
fi
.PHONY: bin default generate test testacc updatedeps vet