|
| 1 | +# Define pkgs, run, and cover vairables for test so that we can override them in |
| 2 | +# the terminal more easily. |
| 3 | +pkgs := $(shell go list ./...) |
| 4 | +run := . |
| 5 | +count := 1 |
| 6 | + |
| 7 | +## help: Show this help message |
| 8 | +help: Makefile |
| 9 | + @echo " Choose a command run in "$(PROJECTNAME)":" |
| 10 | + @sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /' |
| 11 | +.PHONY: help |
| 12 | + |
| 13 | +## clean: clean testcache |
| 14 | +clean: |
| 15 | + @echo "--> Clearing testcache" |
| 16 | + @go clean --testcache |
| 17 | +.PHONY: clean |
| 18 | + |
| 19 | +## cover: generate to code coverage report. |
| 20 | +cover: |
| 21 | + @echo "--> Generating Code Coverage" |
| 22 | + @go install github.com/ory/go-acc@latest |
| 23 | + @go-acc -o coverage.txt $(pkgs) |
| 24 | +.PHONY: cover |
| 25 | + |
| 26 | +## deps: Install dependencies |
| 27 | +deps: |
| 28 | + @echo "--> Installing dependencies" |
| 29 | + @go mod download |
| 30 | +# @make proto-gen |
| 31 | + @go mod tidy |
| 32 | +.PHONY: deps |
| 33 | + |
| 34 | +## lint: Run linters golangci-lint and markdownlint. |
| 35 | +lint: vet |
| 36 | + @echo "--> Running golangci-lint" |
| 37 | + @golangci-lint run |
| 38 | + @echo "--> Running markdownlint" |
| 39 | + @markdownlint --config .markdownlint.yaml '**/*.md' |
| 40 | + @echo "--> Running yamllint" |
| 41 | + @yamllint --no-warnings . -c .yamllint.yml |
| 42 | + |
| 43 | +.PHONY: lint |
| 44 | + |
| 45 | +## fmt: Run fixes for linters. Currently only markdownlint. |
| 46 | +fmt: |
| 47 | + @echo "--> Formatting markdownlint" |
| 48 | + @markdownlint --config .markdownlint.yaml '**/*.md' -f |
| 49 | + @echo "--> Formatting go" |
| 50 | + @golangci-lint run --fix |
| 51 | +.PHONY: fmt |
| 52 | + |
| 53 | +## vet: Run go vet |
| 54 | +vet: |
| 55 | + @echo "--> Running go vet" |
| 56 | + @go vet $(pkgs) |
| 57 | +.PHONY: vet |
| 58 | + |
| 59 | +## test: Running unit tests |
| 60 | +test: vet |
| 61 | + @echo "--> Running unit tests" |
| 62 | + @go test -v -race -covermode=atomic -coverprofile=coverage.txt $(pkgs) -run $(run) -count=$(count) |
| 63 | +.PHONY: test |
0 commit comments