-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (55 loc) · 1.96 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
install:
go get -v ./...
go mod download
go install golang.org/x/tools/cmd/goimports@latest
go get golang.org/x/perf/cmd/benchstat
go install golang.org/x/perf/cmd/benchstat
go install honnef.co/go/tools/cmd/staticcheck@latest
start:
go run main.go
dev:
go run main.go -isDev=true
build:
go build ./...
doc:
@echo "Generating docs..."
go run docs/generate.go ./samples ./samples/api ./samples/array ./samples/cache ./samples/chart ./samples/config ./samples/crypto ./samples/date ./samples/function ./samples/helper ./samples/io ./samples/io/dir ./samples/io/file ./samples/io/path ./samples/math/check ./samples/math/operator ./samples/math/geometry ./samples/math/fomular ./samples/net ./samples/number ./samples/regex ./samples/strings ./samples/structs ./samples/tools ./samples/types/cast ./samples/types/check
@echo "Done!"
test:
@echo "Running tests..."
go clean -testcache
go test -v -count=1 -cover -coverprofile=coverage.out ./cache/... ./chart/... ./date/... ./number/... ./regex/... ./strings/... ./structs/... ./types/...
go tool cover -func=coverage.out
@echo "Done!"
BENCH_CMD = go test -count 5 -run=^\# -bench=. ./number/... ./regex/...
bench:
@echo "Running benchmarks..."
$(BENCH_CMD)
@echo "Done!"
bench_filter:
BENCH_CMD -benchmem > $(f)
bench_stat:
@echo "Running stat filter benchmarks..."
make bench_filter f=old.txt
make bench_filter f=new.txt
benchstat old.txt new.txt
@echo "Done!"
format:
@echo "Running format..."
gofmt -w -s . && goimports -w . && go fmt ./...
@echo "Done!"
lint:
@echo "Running lint..."
staticcheck ./...
@echo "Done!"
count:
@echo "Counting lines..."
bash count.sh public/count.svg true 13708a api array cache chart config connection crypto console date function helper io log math net number regex strings structs tools types
@echo "Done!"
pre:
make build && make test && make format && make lint && make doc
git add .
clean:
go clean -i -x -cache -testcache -modcache
rm -rf coverage.out
rm -rf ./tmp