-
Notifications
You must be signed in to change notification settings - Fork 210
/
Makefile
44 lines (38 loc) · 1.22 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
.PHONY: all clean clean-coverage install install-dependencies install-tools lint test test-verbose test-with-coverage
export ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
export PKG := github.com/sergi/go-diff
export ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
$(eval $(ARGS):;@:) # turn arguments into do-nothing targets
export ARGS
ifdef ARGS
PKG_TEST := $(ARGS)
else
PKG_TEST := $(PKG)/...
endif
all: install-tools install-dependencies install lint test
clean:
go clean -i $(PKG)/...
go clean -i -race $(PKG)/...
clean-coverage:
find $(ROOT_DIR) | grep .coverprofile | xargs rm
install:
go install -v $(PKG)/...
install-dependencies:
go get -t -v $(PKG)/...
go build -v $(PKG)/...
install-tools:
# Install linting tools
go get -u -v golang.org/x/lint/...
go get -u -v github.com/kisielk/errcheck/...
# Install code coverage tools
go get -u -v github.com/onsi/ginkgo/ginkgo/...
go get -u -v github.com/modocache/gover/...
go get -u -v github.com/mattn/goveralls/...
lint:
$(ROOT_DIR)/scripts/lint.sh
test:
go test -race -test.timeout 120s $(PKG_TEST)
test-verbose:
go test -race -test.timeout 120s -v $(PKG_TEST)
test-with-coverage:
ginkgo -r -cover -race -skipPackage="testdata"