1
+ TEST? =./...
2
+ PKG_NAME =es
3
+ GOFMT_FILES? =$$(find . -name '*.go' |grep -v vendor )
4
+ WEBSITE_REPO =github.com/hashicorp/terraform-website
5
+
6
+ default : build
7
+
8
+ build : fmtcheck
9
+ go install
10
+
11
+ gen :
12
+ rm -f aws/internal/keyvaluetags/* _gen.go
13
+ go generate ./...
14
+
15
+ test : fmtcheck
16
+ go test $(TEST ) -timeout=30s -parallel=4
17
+
18
+ testacc : fmt fmtcheck
19
+ TF_ACC=1 go test $(TEST ) -v -count 1 -parallel 20 $(TESTARGS ) -timeout 120m
20
+
21
+ fmt :
22
+ @echo " ==> Fixing source code with gofmt..."
23
+ gofmt -s -w ./$(PKG_NAME )
24
+
25
+ # Currently required by tf-deploy compile
26
+ fmtcheck :
27
+ @sh -c " '$( CURDIR) /scripts/gofmtcheck.sh'"
28
+
29
+ websitefmtcheck :
30
+ @sh -c " '$( CURDIR) /scripts/websitefmtcheck.sh'"
31
+
32
+ lint :
33
+ @echo " ==> Checking source code against linters..."
34
+ @golangci-lint run --no-config --deadline 5m --disable-all --enable staticcheck --exclude SA1019 --max-issues-per-linter 0 --max-same-issues 0 ./$(PKG_NAME ) /...
35
+ @golangci-lint run ./$(PKG_NAME ) /...
36
+ @tfproviderlint \
37
+ -c 1 \
38
+ -AT001 \
39
+ -S001 \
40
+ -S002 \
41
+ -S003 \
42
+ -S004 \
43
+ -S005 \
44
+ -S007 \
45
+ -S008 \
46
+ -S009 \
47
+ -S010 \
48
+ -S011 \
49
+ -S012 \
50
+ -S013 \
51
+ -S014 \
52
+ -S015 \
53
+ -S016 \
54
+ -S017 \
55
+ -S019 \
56
+ ./$(PKG_NAME )
57
+
58
+ tools :
59
+ GO111MODULE=on go install github.com/bflad/tfproviderlint/cmd/tfproviderlint
60
+ GO111MODULE=on go install github.com/client9/misspell/cmd/misspell
61
+ GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint
62
+
63
+ test-compile :
64
+ @if [ " $( TEST) " = " ./..." ]; then \
65
+ echo " ERROR: Set TEST to a specific package. For example," ; \
66
+ echo " make test-compile TEST=./$( PKG_NAME) " ; \
67
+ exit 1; \
68
+ fi
69
+ go test -c $(TEST ) $(TESTARGS )
70
+
71
+ website :
72
+ ifeq (,$(wildcard $(GOPATH ) /src/$(WEBSITE_REPO ) ) )
73
+ echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
74
+ git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
75
+ endif
76
+ @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
77
+
78
+ website-lint :
79
+ @echo " ==> Checking website against linters..."
80
+ @misspell -error -source=text website/
81
+
82
+ website-test :
83
+ ifeq (,$(wildcard $(GOPATH ) /src/$(WEBSITE_REPO ) ) )
84
+ echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
85
+ git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
86
+ endif
87
+ @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
88
+
89
+ .PHONY : build gen sweep test testacc fmt fmtcheck lint tools test-compile website website-lint website-test
0 commit comments