-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Makefile
83 lines (67 loc) · 1.86 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
SHELL := /bin/bash -o pipefail
UNAME_OS := $(shell uname -s)
UNAME_ARCH := $(shell uname -m)
TMP_BASE := .tmp
TMP := $(TMP_BASE)/$(UNAME_OS)/$(UNAME_ARCH)
TMP_BIN = $(TMP)/bin
GOLINT_VERSION := 8f45f776aaf18cebc8d65861cc70c33c60471952
GOLINT := $(TMP_BIN)/golint
$(GOLINT):
$(eval GOLINT_TMP := $(shell mktemp -d))
@cd $(GOLINT_TMP); go get github.com/golang/lint/golint@$(GOLINT_VERSION)
@rm -rf $(GOLINT_TMP)
ERRCHECK_VERSION := v1.2.0
ERRCHECK := $(TMP_BIN)/errcheck
$(ERRCHECK):
$(eval ERRCHECK_TMP := $(shell mktemp -d))
@cd $(ERRCHECK_TMP); go get github.com/kisielk/errcheck@$(ERRCHECK_VERSION)
@rm -rf $(ERRCHECK_TMP)
STATICCHECK_VERSION := c2f93a96b099cbbec1de36336ab049ffa620e6d7
STATICCHECK := $(TMP_BIN)/staticcheck
$(STATICCHECK):
$(eval STATICCHECK_TMP := $(shell mktemp -d))
@cd $(STATICCHECK_TMP); go get honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
@rm -rf $(STATICCHECK_TMP)
unexport GOPATH
export GO111MODULE := on
export GOBIN := $(abspath $(TMP_BIN))
export PATH := $(GOBIN):$(PATH)
.DEFAULT_GOAL := all
.PHONY: all
all: lint test
.PHONY: install
install:
go install ./...
.PHONY: golint
golint: $(GOLINT)
@# TODO: readd cmd/proto2gql when fixed
@#for file in $(shell find . -name '*.go'); do
for file in $(shell find . -name '*.go' | grep -v cmd/proto2gql); do \
golint $${file}; \
if [ -n "$$(golint $${file})" ]; then \
exit 1; \
fi; \
done
.PHONY: vet
vet:
go vet ./...
.PHONY: testdeps
errcheck: $(ERRCHECK)
errcheck ./...
.PHONY: staticcheck
staticcheck: $(STATICCHECK)
staticcheck -checks "all -U1000" ./...
.PHONY: lint
# TODO: readd errcheck when fixed
#lint: golint vet errcheck staticcheck
#lint: golint vet staticcheck
lint: golint vet
.PHONY: test
test:
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: clean
clean:
go clean -i ./...
.PHONY: integration
integration:
PB=y go test -cover