Makefile

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