Makefile raw

   1  .POSIX:
   2  .SUFFIXES:
   3  
   4  all: test lint
   5  
   6  test:
   7  	go test -race -shuffle=on -cover .
   8  
   9  test/cover:
  10  	go test -race -shuffle=on -coverprofile=coverage.out .
  11  	go tool cover -html=coverage.out
  12  
  13  lint:
  14  	golangci-lint run
  15  
  16  tidy:
  17  	go mod tidy
  18  
  19  generate:
  20  	go generate ./...
  21  
  22  # run `make pre-commit` once to install the hook.
  23  pre-commit: .git/hooks/pre-commit test lint tidy generate
  24  	git diff --exit-code
  25  
  26  .git/hooks/pre-commit:
  27  	echo "make pre-commit" > .git/hooks/pre-commit
  28  	chmod +x .git/hooks/pre-commit
  29