-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (50 loc) · 1.7 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
## High-level targets
PROJECTS=gitutil logutil mongoutil panicrecover queryid prometrics
.PHONY: build check
build: build.tidy build.all
check: check.fmt check.imports check.lint check.test
publish: publish.projects
## Build target
.PHONY: build.tidy build.all
build.tidy:
for project in $(PROJECTS); do \
cd $(PWD)/$$project && GO111MODULE=on go mod tidy; \
done
build.all:
for project in $(PROJECTS); do \
cd $(PWD)/$$project && GO111MODULE=on go build; \
done
## Check target
LINT_FOLDER=$(PWD)/lint
METALINTER_COMMAND=gometalinter --enable-all --disable=gochecknoglobals --disable=gochecknoinits --disable=lll --min-confidence=0.0 --deadline=180s -j 4
.PHONY: check.fmt check.imports check.lint check.test check.lint.golangci check.lint.gometalinter
check.fmt:
for project in $(PROJECTS); do \
cd $(PWD)/$$project && GO111MODULE=on gofmt -s -w ./*.go; \
done
check.imports:
for project in $(PROJECTS); do \
cd $(PWD)/$$project && GO111MODULE=on goimports -w ./*.go; \
done
check.lint: check.lint.golangci check.lint.gometalinter
check.lint.golangci:
@mkdir -p $(LINT_FOLDER)
for project in $(PROJECTS); do \
cd $(PWD)/$$project && GO111MODULE=on golangci-lint run > $(LINT_FOLDER)/$$project.golangci 2>&1; \
done
check.lint.gometalinter:
@mkdir -p $(LINT_FOLDER)
for project in $(PROJECTS); do \
cd $(PWD)/$$project && GO111MODULE=on $(METALINTER_COMMAND) ./... > $(LINT_FOLDER)/$$project.gometalinter 2>&1; \
done
check.test:
for project in $(PROJECTS); do \
cd $(PWD)/$$project && GO111MODULE=on go test; \
done
## Publish targets
VERSION=v0.0.1
.PHONY: publish.projects
publish.projects:
for project in $(PROJECTS); do \
git tag $$project/$(VERSION); \
done