| 1 |
BIN="./bin" |
| 2 |
SRC=$(shell find . -name "*.go") |
| 3 |
|
| 4 |
ifeq (, $(shell which golangci-lint)) |
| 5 |
$(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh") |
| 6 |
endif |
| 7 |
|
| 8 |
.PHONY: fmt lint test install_deps clean |
| 9 |
|
| 10 |
default: all |
| 11 |
|
| 12 |
all: fmt test |
| 13 |
|
| 14 |
fmt: |
| 15 |
$(info ******************** checking formatting ********************) |
| 16 |
@test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1) |
| 17 |
|
| 18 |
lint: |
| 19 |
$(info ******************** running lint tools ********************) |
| 20 |
golangci-lint run -v |
| 21 |
|
| 22 |
test: install_deps |
| 23 |
$(info ******************** running tests ********************) |
| 24 |
go test -v ./... |
| 25 |
|
| 26 |
richtest: install_deps |
| 27 |
$(info ******************** running tests with kyoh86/richgo ********************) |
| 28 |
richgo test -v ./... |
| 29 |
|
| 30 |
install_deps: |
| 31 |
$(info ******************** downloading dependencies ********************) |
| 32 |
go get -v ./... |
| 33 |
|
| 34 |
clean: |
| 35 |
rm -rf $(BIN) |