forked from twpayne/go-geom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (37 loc) · 1.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
GOLANGCI_LINT_VERSION=1.37.1
.PHONY: all
all: test lint
.PHONY: test
test:
go test ./...
.PHONY: coverage.out
coverage.out:
go test -covermode=count --coverprofile=$@ ./...
.PHONY: lint
lint:
./bin/golangci-lint run
.PHONY: format
format:
find . -name \*.go | xargs bin/gofumports -local github.com/twpayne/go-geom -w
.PHONY: generate
generate:
PATH=$$PATH:$(shell pwd)/bin go generate ./...
.PHONY: install-tools
install-tools: ensure-goderive ensure-gofumports ensure-golangci-lint
.PHONY: ensure-goderive
ensure-goderive:
if [ ! -x bin/goderive ] ; then \
mkdir -p bin ; \
( cd $$(mktemp -d) && go mod init tmp && GOBIN=$(shell pwd)/bin go get github.com/awalterschulze/goderive ) ; \
fi
.PHONY: ensure-gofumports
ensure-gofumports:
if [ ! -x bin/gofumports ] ; then \
mkdir -p bin ; \
( cd $$(mktemp -d) && go mod init tmp && GOBIN=$(shell pwd)/bin go get mvdan.cc/gofumpt/gofumports ) ; \
fi
.PHONY: ensure-golangci-lint
ensure-golangci-lint:
if [ ! -x bin/golangci-lint ] || ( ./bin/golangci-lint --version | grep -Fqv "version ${GOLANGCI_LINT_VERSION}" ) ; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v${GOLANGCI_LINT_VERSION} ; \
fi