.DEFAULT_GOAL := help # ==================================================================================== # # HELPERS # ==================================================================================== # ## help: print this help message .PHONY: help help: @echo 'Usage:' @sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' ## all: tidy + audit + test/cover all: generate tidy test lint test/cover # ==================================================================================== # # QUALITY CONTROL # ==================================================================================== # ## tidy: format code and tidy modfile .PHONY: tidy tidy: go fmt ./... goimports -local=$(shell cat go.mod | grep module | awk '{print $$2}')/ -w . go mod tidy -v ## audit: run quality control checks .PHONY: lint lint: go mod verify go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -v ./... # ==================================================================================== # # DEVELOPMENT # ==================================================================================== # ## generate: run all generators .PHONY: generate generate: go generate ./... ## test: run all tests .PHONY: test test: go test -race -buildvcs ./... ## test/cover: run all tests and display coverage .PHONY: test/cover test/cover: go test -race -buildvcs -coverprofile=/tmp/coverage.out ./... go tool cover -html=/tmp/coverage.out