-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
80 lines (62 loc) · 1.72 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
GOPATH:=$(shell go env GOPATH)
GO_SOURCES := $(wildcard *.go)
GO_SOURCES += $(shell find . -type f -name "*.go")
GOFMT ?= gofmt -s
ifeq ($(filter $(TAGS_SPLIT),bindata),bindata)
GO_SOURCES += $(BINDATA_DEST)
endif
GO_SOURCES_OWN := $(filter-out vendor/%, $(GO_SOURCES))
PROTO_SRC_DIR := ${PWD}/proto
PROTO_DST_DIR := ${PWD}/proto
.PHONY: proto
proto:
mkdir -p ${PROTO_DST_DIR} && protoc -I=${PROTO_SRC_DIR} --go_out=plugins=grpc:${PROTO_DST_DIR} ${PROTO_SRC_DIR}/service.proto
.PHONY: build
build:
go build -o GraphRPC *.go
.PHONY: test
test:
go test -v ./... -cover
gen-mocks:
go generate ./...
local: gen-mocks
go run main.go -a 127.0.0.1 -p 5000
tools:
go get golang.org/x/tools/cmd/goimports
go get github.com/kisielk/errcheck
go get golang.org/x/lint/golint
go get github.com/axw/gocov/gocov
go get github.com/matm/gocov-html
go get github.com/tools/godep
go get github.com/mitchellh/gox
lint:
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
export BINARY="golangci-lint"; \
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.31.0; \
fi
golangci-lint run --timeout 5m
vet:
go vet -v ./...
fmt:
gofmt -w .
fmt-check:
@diff=$$($(GOFMT) -d $(GO_SOURCES_OWN)); \
if [ -n "$$diff" ]; then \
echo "Please run 'make fmt' and commit the result:"; \
echo "$${diff}"; \
exit 1; \
fi;
errors:
errcheck -ignoretests -blank ./...
coverage:
gocov test ./... > $(CURDIR)/coverage.out 2>/dev/null
gocov report $(CURDIR)/coverage.out
if test -z "$$CI"; then \
gocov-html $(CURDIR)/coverage.out > $(CURDIR)/coverage.html; \
if which open &>/dev/null; then \
open $(CURDIR)/coverage.html; \
fi; \
fi
.PHONY: schema
schema:
./libs/mage