diff --git a/Makefile b/Makefile index 80ffe3a..0ff6fc0 100644 --- a/Makefile +++ b/Makefile @@ -6,24 +6,44 @@ VERSION := $(shell awk -F'"' '/const version/{gsub(/^v/, "", $$2); print $$2}' c .PHONY: test cover clean update patch minor major tag -# Run all unit tests -test: +##@ General + +.PHONY: help +help: ## Display this help. + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +##@ Development + +.PHONY: download +download: ## Download go packages + go mod download + +.PHONY: update-packages +update-packages: ## Update all Go packages to their latest versions + go get -u ./... + go mod tidy + +.PHONY: fmt +fmt: ## Run go fmt against code. + go fmt ./... + +.PHONY: vet +vet: ## Run go vet against code. + go vet ./... + +.PHONY: test +test: ## Run all unit tests go test ./... -v -count=1 -# Generate and display test coverage -cover: +.PHONY: cover +cover: ## Generate and display test coverage go test ./cmd/... ./internal/... -count=1 -coverprofile=coverage.out go tool cover -html=coverage.out -# Clean up generated files -clean: +.PHONY: clean +clean: ## Clean up generated files rm -f coverage.out coverage.html -# Update dependencies -update: - go get -u ./... - go mod tidy - ##@ Versioning patch: ## Increment the patch version (x.y.Z -> x.y.(Z+1)).