2017-06-05 16:59:08 -04:00
|
|
|
TEST?=$$(go list ./... |grep -v 'vendor')
|
|
|
|
|
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
|
2018-04-27 11:57:13 -04:00
|
|
|
PKG_NAME=docker
|
2017-06-05 16:59:08 -04:00
|
|
|
|
|
|
|
|
default: build
|
|
|
|
|
|
|
|
|
|
build: fmtcheck
|
|
|
|
|
go install
|
|
|
|
|
|
2020-12-27 05:02:34 -05:00
|
|
|
setup:
|
|
|
|
|
go mod download
|
|
|
|
|
cd tools && GO111MODULE=on go install github.com/client9/misspell/cmd/misspell
|
|
|
|
|
cd tools && GO111MODULE=on go install github.com/katbyte/terrafmt
|
|
|
|
|
cd tools && GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint
|
|
|
|
|
|
|
|
|
|
golangci-lint:
|
|
|
|
|
@golangci-lint run ./$(PKG_NAME)/...
|
|
|
|
|
|
2017-06-06 16:27:01 -04:00
|
|
|
test: fmtcheck
|
2017-06-05 16:59:08 -04:00
|
|
|
go test -i $(TEST) || exit 1
|
|
|
|
|
echo $(TEST) | \
|
|
|
|
|
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
|
|
|
|
|
|
2019-06-01 06:01:42 -04:00
|
|
|
testacc_setup: fmtcheck
|
|
|
|
|
@sh -c "'$(CURDIR)/scripts/testacc_setup.sh'"
|
|
|
|
|
|
2017-06-05 16:59:08 -04:00
|
|
|
testacc: fmtcheck
|
2019-06-01 06:01:42 -04:00
|
|
|
@sh -c "'$(CURDIR)/scripts/testacc_full.sh'"
|
|
|
|
|
|
|
|
|
|
testacc_cleanup: fmtcheck
|
|
|
|
|
@sh -c "'$(CURDIR)/scripts/testacc_cleanup.sh'"
|
2017-06-05 16:59:08 -04:00
|
|
|
|
2018-07-03 11:30:53 -04:00
|
|
|
compile: fmtcheck
|
|
|
|
|
@sh -c "'$(CURDIR)/scripts/compile.sh'"
|
|
|
|
|
|
2017-06-05 16:59:08 -04:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
fmt:
|
2020-12-02 07:04:53 -05:00
|
|
|
gofmt -s -w $(GOFMT_FILES)
|
2017-06-05 16:59:08 -04:00
|
|
|
|
|
|
|
|
fmtcheck:
|
|
|
|
|
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
|
|
|
|
|
|
|
|
|
|
errcheck:
|
|
|
|
|
@sh -c "'$(CURDIR)/scripts/errcheck.sh'"
|
|
|
|
|
|
|
|
|
|
|
2017-06-30 04:15:38 -04:00
|
|
|
test-compile:
|
|
|
|
|
@if [ "$(TEST)" = "./..." ]; then \
|
|
|
|
|
echo "ERROR: Set TEST to a specific package. For example,"; \
|
2018-04-27 11:57:13 -04:00
|
|
|
echo " make test-compile TEST=./$(PKG_NAME)"; \
|
2017-06-30 04:15:38 -04:00
|
|
|
exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
go test -c $(TEST) $(TESTARGS)
|
|
|
|
|
|
2020-12-27 05:02:34 -05:00
|
|
|
website-link-check:
|
|
|
|
|
@scripts/markdown-link-check.sh
|
|
|
|
|
|
|
|
|
|
website-lint:
|
|
|
|
|
@echo "==> Checking website against linters..."
|
|
|
|
|
@misspell -error -source=text website/ || (echo; \
|
|
|
|
|
echo "Unexpected mispelling found in website files."; \
|
|
|
|
|
echo "To automatically fix the misspelling, run 'make website-lint-fix' and commit the changes."; \
|
|
|
|
|
exit 1)
|
|
|
|
|
@docker run -v $(PWD):/markdown 06kellyjac/markdownlint-cli website/docs/ || (echo; \
|
|
|
|
|
echo "Unexpected issues found in website Markdown files."; \
|
|
|
|
|
echo "To apply any automatic fixes, run 'make website-lint-fix' and commit the changes."; \
|
|
|
|
|
exit 1)
|
|
|
|
|
@terrafmt diff ./website --check --pattern '*.markdown' --quiet || (echo; \
|
|
|
|
|
echo "Unexpected differences in website HCL formatting."; \
|
|
|
|
|
echo "To see the full differences, run: terrafmt diff ./website --pattern '*.markdown'"; \
|
|
|
|
|
echo "To automatically fix the formatting, run 'make website-lint-fix' and commit the changes."; \
|
|
|
|
|
exit 1)
|
|
|
|
|
|
|
|
|
|
website-lint-fix:
|
|
|
|
|
@echo "==> Applying automatic website linter fixes..."
|
|
|
|
|
@misspell -w -source=text website/
|
|
|
|
|
@docker run -v $(PWD):/markdown 06kellyjac/markdownlint-cli --fix website/docs/
|
|
|
|
|
@terrafmt fmt ./website --pattern '*.markdown'
|
|
|
|
|
|
|
|
|
|
.PHONY: build test testacc vet fmt fmtcheck errcheck test-compile website-link-check website-lint website-lint-fix
|
2017-06-05 16:59:08 -04:00
|
|
|
|