author | Mikael Berthe <mikael@lilotux.net> |
Sat, 04 Feb 2023 12:58:35 +0100 | |
changeset 265 | 05c40b36d3b2 |
parent 260 | 445e01aede7e |
permissions | -rw-r--r-- |
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)) |
|
265
05c40b36d3b2
Bump to version 3.0.0-dev, using madon v3
Mikael Berthe <mikael@lilotux.net>
parents:
260
diff
changeset
|
9 |
$(warning "could not find richgo in $(PATH), run: go install github.com/kyoh86/richgo@latest") |
256 | 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) |