From 1964f4da98dc2148b3ff72ea3e44750211dadb92 Mon Sep 17 00:00:00 2001 From: Tom <73077675+tmzane@users.noreply.github.com> Date: Fri, 15 Mar 2024 01:15:15 +0500 Subject: [PATCH] chore: add Makefile --- Makefile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6165b16 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +.POSIX: +.SUFFIXES: + +all: test lint + +test: + go test -race -shuffle=on -cover ./... + +test/cover: + go test -race -shuffle=on -coverprofile=coverage.out ./... + go tool cover -html=coverage.out + +lint: + golangci-lint run + +tidy: + go mod tidy + +generate: + go generate ./... + +# run `make pre-commit` once to install the hook. +pre-commit: .git/hooks/pre-commit test lint tidy generate + git diff --exit-code + +.git/hooks/pre-commit: + echo "make pre-commit" > .git/hooks/pre-commit + chmod +x .git/hooks/pre-commit