-
Notifications
You must be signed in to change notification settings - Fork 286
/
Copy pathGNUmakefile
82 lines (62 loc) · 2.18 KB
/
GNUmakefile
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
70
71
72
73
74
75
76
77
78
79
80
81
82
TEST?=$$(go list ./... |grep -v 'vendor')
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
PKG_NAME?=digitalocean
ACCTEST_TIMEOUT?=120m
ACCTEST_PARALLELISM?=2
default: build
build: fmtcheck
go install
test: fmtcheck
go test $(TEST) || exit 1
echo $(TEST) | \
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
testacc: fmtcheck
TF_ACC=1 go test -v ./$(PKG_NAME)/... $(TESTARGS) -timeout $(ACCTEST_TIMEOUT) -parallel=$(ACCTEST_PARALLELISM)
vet:
@echo "go vet ."
@go vet $$(go list ./... | grep -v vendor/) ; 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
sweep:
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
go test ./digitalocean/sweep/... -v -sweep=1
goimports:
@echo "==> Fixing imports code with goimports..."
@find . -name '*.go' | grep -v vendor | grep -v generator-resource-id | while read f; do goimports -w "$$f"; done
install-golangci-lint:
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
lint: install-golangci-lint
@golangci-lint run -v ./...
fmt:
gofmt -s -w $(GOFMT_FILES)
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
install-terrafmt:
@go install github.com/katbyte/terrafmt@latest
terrafmt: install-terrafmt # Formats Terraform configuration blocks in tests.
@terrafmt fmt --fmtcompat digitalocean/
@terrafmt fmt --fmtcompat docs/
terrafmt-check: install-terrafmt # Returns non-0 exit code if terrafmt would make a change.
@terrafmt diff --check --fmtcompat digitalocean/
@terrafmt diff --check --fmtcompat docs/
errcheck:
@sh -c "'$(CURDIR)/scripts/errcheck.sh'"
website:
@echo "Use this site to preview markdown rendering: https://registry.terraform.io/tools/doc-preview"
.PHONY: build test testacc vet fmt fmtcheck errcheck test-compile website sweep
.PHONY: _upgrade_godo
_upgrade_godo:
go get -u github.com/digitalocean/godo
.PHONY: upgrade_godo
upgrade_godo: _upgrade_godo vendor
@echo "==> upgrade the godo version"
@echo ""
.PHONY: vendor
vendor:
@echo "==> vendor dependencies"
@echo ""
go mod vendor
go mod tidy