forked from squat/terraform-provider-vultr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (55 loc) · 1.75 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.PHONY: build fmt fmt-go fmt-terraform lint lint-go lint-terraform test vendor vendor-status vet
TEST?=$$(go list ./... | grep -v 'vendor/')
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
TERRAFORMFMT_FILES?=examples
TESTARGS?=
default: build
build:
go install
fmt: fmt-go fmt-terraform
fmt-go:
gofmt -w -s $(GOFMT_FILES)
fmt-terraform:
terraform fmt $(TERRAFORMFMT_FILES)
lint: lint-go lint-terraform
lint-go:
@echo 'golint $(TEST)'
@lint_res=$$(golint $(TEST)); if [ -n "$$lint_res" ]; then \
echo ""; \
echo "Golint found style issues. Please check the reported issues"; \
echo "and fix them if necessary before submitting the code for review:"; \
echo "$$lint_res"; \
exit 1; \
fi
@echo 'gofmt -d -s $(GOFMT_FILES)'
@fmt_res=$$(gofmt -d -s $(GOFMT_FILES)); if [ -n "$$fmt_res" ]; then \
echo ""; \
echo "Gofmt found style issues. Please check the reported issues"; \
echo "and fix them if necessary before submitting the code for review:"; \
echo "$$fmt_res"; \
exit 1; \
fi
lint-terraform:
@echo "terraform fmt $(TERRAFORMFMT_FILES)"
@lint_res=$$(terraform fmt $(TERRAFORMFMT_FILES)); if [ -n "$$lint_res" ]; then \
echo ""; \
echo "Terraform fmt found style issues. Please check the reported issues"; \
echo "and fix them if necessary before submitting the code for review:"; \
echo "$$lint_res"; \
exit 1; \
fi
test: vet lint
go test -i $(TEST) || exit 1
go test $(TESTARGS) -timeout=30s -parallel=4 $(TEST)
vendor:
@glide install -v
vendor-status:
@glide list
vet:
@echo 'go vet $(TEST)'
@go vet $(TEST); 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 review."; \
exit 1; \
fi