2020-02-20 19:25:38 +00:00
|
|
|
BIN="./bin"
|
|
|
|
SRC=$(shell find . -name "*.go")
|
|
|
|
|
2021-02-08 00:08:50 +00:00
|
|
|
ifeq (, $(shell which golangci-lint))
|
2022-10-18 19:47:53 +00:00
|
|
|
$(warning "could not find golangci-lint in PATH, see here for installation details: https://golangci-lint.run/usage/install/")
|
2021-02-08 00:08:50 +00:00
|
|
|
endif
|
|
|
|
|
2020-02-20 19:25:38 +00:00
|
|
|
ifeq (, $(shell which richgo))
|
2022-10-09 13:21:38 +00:00
|
|
|
$(warning "could not find richgo in PATH, run: go install github.com/kyoh86/richgo@latest")
|
2020-02-20 19:25:38 +00:00
|
|
|
endif
|
|
|
|
|
2022-03-10 15:19:35 +00:00
|
|
|
.PHONY: fmt lint test install_deps clean
|
2020-02-20 19:25:38 +00:00
|
|
|
|
|
|
|
default: all
|
|
|
|
|
2022-03-10 15:19:35 +00:00
|
|
|
all: fmt test
|
2020-02-20 19:25:38 +00:00
|
|
|
|
|
|
|
fmt:
|
|
|
|
$(info ******************** checking formatting ********************)
|
|
|
|
@test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
|
|
|
|
|
2021-02-08 00:08:50 +00:00
|
|
|
lint:
|
|
|
|
$(info ******************** running lint tools ********************)
|
|
|
|
golangci-lint run -v
|
|
|
|
|
2021-12-07 23:06:09 +00:00
|
|
|
test: install_deps
|
2020-02-20 19:25:38 +00:00
|
|
|
$(info ******************** running tests ********************)
|
|
|
|
richgo test -v ./...
|
|
|
|
|
|
|
|
install_deps:
|
|
|
|
$(info ******************** downloading dependencies ********************)
|
|
|
|
go get -v ./...
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(BIN)
|