-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
executable file
·67 lines (52 loc) · 1.99 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
GO_VERSION:=$(shell go version)
.PHONY: all clean bench bench-all profile lint test contributors update install
GOPATH := $(eval GOPATH := $(shell go env GOPATH))$(GOPATH)
GOLINES_MAX_WIDTH ?= 200
all: clean install lint test bench
clean:
go clean ./...
go clean -modcache
rm -rf ./*.log \
./*.svg \
./go.* \
pprof \
bench \
vendor
bench: clean init
sleep 3
go test -count=1 -timeout=30m -run=NONE -bench . -benchmem
init:
GO111MODULE=on go mod init github.com/kpango/gache/v2
GO111MODULE=on go mod tidy
profile: clean init
rm -rf bench
mkdir bench
mkdir pprof
\
# go test -count=3 -timeout=30m -run=NONE -bench=BenchmarkChangeOutAllInt_gache -benchmem -o pprof/gache-test.bin -cpuprofile pprof/cpu-gache.out -memprofile pprof/mem-gache.out
go test -count=3 -timeout=30m -run=NONE -bench=BenchmarkGacheSetBigDataWithTTL -benchmem -o pprof/gache-test.bin -cpuprofile pprof/cpu-gache.out -memprofile pprof/mem-gache.out
go tool pprof --svg pprof/gache-test.bin pprof/cpu-gache.out > cpu-gache.svg
go tool pprof --svg pprof/gache-test.bin pprof/mem-gache.out > mem-gache.svg
\
mv ./*.svg bench/
profile-web-cpu:
go tool pprof -http=":6061" \
pprof/gache-test.bin \
pprof/cpu-gache.out
profile-web-mem:
go tool pprof -http=":6062" \
pprof/gache-test.bin \
pprof/mem-gache.out
lint:
gometalinter --enable-all . | rg -v comment
test:
GO111MODULE=on go test --race -v $(go list ./... | rg -v vendor)
contributors:
git log --format='%aN <%aE>' | sort -fu > CONTRIBUTORS
run:
go run example/main.go
format:
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs $(GOPATH)/bin/golines -w -m $(GOLINES_MAX_WIDTH)
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs $(GOPATH)/bin/gofumpt -w
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs $(GOPATH)/bin/strictgoimports -w
find ./ -type d -name .git -prune -o -type f -regex '.*\.go' -print | xargs $(GOPATH)/bin/goimports -w