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