forked from trpc-ecosystem/go-opentelemetry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (73 loc) · 2.05 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
84
85
86
ALL_SRC := $(shell find . -name '*.go' \
-not -path './opentelemetry/proto/*' \
-type f | sort)
ALL_DOC := $(shell find . \( -name "*.md" -o -name "*.yaml" \) \
-type f | sort)
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
MISSPELL=misspell -error
IMPI=impi
GOTEST_MIN = go test -gcflags=all=-l -timeout 30s -vet off
GOTEST = $(GOTEST_MIN) -race
GOVET = go vet -printfuncs=addDyeAndCallFunc
GOTEST_WITH_COVERAGE = $(GOTEST) -coverprofile=coverage.out -covermode=atomic -coverpkg=./...
.PHONY: precommit
precommit: fmt vet lint build test examples
.PHONY: impi
impi:
@$(IMPI) --local trpc.group/trpc-go/go-opentelemetry --scheme stdThirdPartyLocal --skip example/trpc/protocol --skip opentelemetry/proto ./...
.PHONY: misspell
misspell:
$(MISSPELL) $(ALL_DOC)
.PHONY: lint
lint:
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
echo "go mod tidy in $${dir}"; \
(cd "$${dir}" && \
go mod tidy); \
done
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
echo "golangci-lint in $${dir}"; \
(cd "$${dir}" && \
golangci-lint run --fix && \
golangci-lint run); \
done
.PHONY: test
test:
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
echo "go test ./... + race in $${dir}"; \
(cd "$${dir}" && \
$(GOTEST) ./...); \
done
.PHONY: vet
vet:
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
echo "go vet ./... in $${dir}"; \
(cd "$${dir}" && \
$(GOVET) ./...); \
done
.PHONY: mod-tidy
mod-tidy:
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
echo "go mod tidy ./.. in $${dir}"; \
(cd "$${dir}" && go mod tidy); \
done
.PHONY: build
build:
@set -e; for dir in $(ALL_GO_MOD_DIRS); do \
(cd "$${dir}" && \
go build -v ./...; \
echo "Build $${dir} success!"; \
); \
done
.PHONY: examples
examples:
@cd example/basic; \
go build -v
@echo "Build basic example success!"
@cd example/log; \
go build -v
@echo "Build log example success!"
.PHONY: fmt
fmt:
gofmt -w -s .
goimports -w -local trpc.group/trpc-go/go-opentelemetry ./