SHELL := bash .SHELLFLAGS := -eu -o pipefail -c .ONESHELL: .DELETE_ON_ERROR: MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules .DEFAULT_GOAL := help ##### Utils #################################################################### .PHONY: confirm confirm: @echo -n 'Are you sure? [y/N] ' && read ans && [ $${ans:-N} = y ] .PHONY: help help: @grep -E '^[a-zA-Z\/_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | sort .PHONY: no-dirty no-dirty: git diff --exit-code ##### Quality ################################################################## .PHONY: check check: ## run all code checks go mod verify go vet ./... go test -race -buildvcs -vet=off ./... .PHONY: tidy tidy: ## tidy up the code go fmt ./... go mod tidy -v ##### Development ############################################################## .PHONY: build build: ## build gonf CGO_ENABLED=0 go build -ldflags "-s -w -extldflags \"-static\"" ./cmd/gonf/ .PHONY: test test: ## run all tests go test -v -race -buildvcs ./... .PHONY: test/cover test/cover: ## Run all tests and generate coverage profile go test -v -race -buildvcs -coverprofile=./coverage.out ./... go tool cover -html=./coverage.out ##### Operations ############################################################### .PHONY: push push: tidy no-dirty check ## push changes to git remote git push git master