github.com/mineiros-io/terradoc@v0.0.9-0.20220711062319-018bd4ae81f5/Makefile (about) 1 # Set default shell to bash 2 SHELL := /bin/bash -o pipefail -o errexit -o nounset 3 4 .PHONY: default 5 default: help 6 7 ## Format go code 8 .PHONY: fmt 9 fmt: 10 go run golang.org/x/tools/cmd/goimports@v0.1.7 -w . 11 12 ## lint code 13 .PHONY: lint 14 lint: 15 go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.43.0 run ./... 16 17 ## test code 18 .PHONY: test 19 test: 20 go test -shuffle=on -race -coverprofile=coverage.txt -covermode=atomic ./... 21 22 ## Build terradoc into bin directory 23 .PHONY: build 24 build: 25 echo "TODO: cmd not added yet" 26 #go build -o bin/terradoc ./cmd/terradoc 27 28 ## remove build artifacts 29 .PHONY: clean 30 clean: 31 rm -rf bin/* 32 33 ## Display help for all targets 34 .PHONY: help 35 help: 36 @awk '/^.PHONY: / { \ 37 msg = match(lastLine, /^## /); \ 38 if (msg) { \ 39 cmd = substr($$0, 9, 100); \ 40 msg = substr(lastLine, 4, 1000); \ 41 printf " ${GREEN}%-30s${RESET} %s\n", cmd, msg; \ 42 } \ 43 } \ 44 { lastLine = $$0 }' $(MAKEFILE_LIST)