1+ TEST? =$$(go list ./... |grep -v 'vendor' )
2+ GOFMT_FILES? =$$(find . -name '*.go' |grep -v vendor )
3+ WEBSITE_REPO =github.com/hashicorp/terraform-website
4+ PKG_NAME =sumologic
5+
6+ default : build
7+
8+ tools :
9+ GO111MODULE=off go get -u github.com/client9/misspell/cmd/misspell
10+ GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
11+
12+ build : fmtcheck
13+ go install
14+
15+ errcheck :
16+ @sh -c " '$( CURDIR) /scripts/errcheck.sh'"
17+
18+ fmt :
19+ @echo " ==> Fixing source code with gofmt..."
20+ gofmt -w $(GOFMT_FILES )
21+
22+ fmtcheck :
23+ @sh -c " '$( CURDIR) /scripts/gofmtcheck.sh'"
24+
25+ lint :
26+ @echo " ==> Checking source code against linters..."
27+ golangci-lint run ./...
28+
29+ test : fmtcheck
30+ go test -i $(TEST ) || exit 1
31+ echo $(TEST ) | \
32+ xargs -t -n4 go test $(TESTARGS ) -timeout=30s -parallel=4
33+
34+ testacc : fmtcheck
35+ TF_ACC=1 go test $(TEST ) -v $(TESTARGS ) -timeout 120m
36+
37+ test-compile :
38+ @if [ " $( TEST) " = " ./..." ]; then \
39+ echo " ERROR: Set TEST to a specific package. For example," ; \
40+ echo " make test-compile TEST=./$( PKG_NAME) " ; \
41+ exit 1; \
42+ fi
43+ go test -c $(TEST ) $(TESTARGS )
44+
45+ website :
46+ ifeq (,$(wildcard $(GOPATH ) /src/$(WEBSITE_REPO ) ) )
47+ echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
48+ git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
49+ endif
50+ @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
51+
52+ website-lint :
53+ @echo " ==> Checking website against linters..."
54+ @misspell -error -source=text website/
55+
56+ website-test :
57+ ifeq (,$(wildcard $(GOPATH ) /src/$(WEBSITE_REPO ) ) )
58+ echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
59+ git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
60+ endif
61+ @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
62+
63+ .PHONY : build test testacc vet fmt fmtcheck errcheck lint tools test-compile website website-lint website-test
0 commit comments