-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (54 loc) · 1.32 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
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
dev:
go run samples/main/index.go -isDev=true
build:
go build ./...
doc:
@echo "Generating docs..."
go run cmd/doc_gen.go ./samples
@echo "Done!"
test:
@echo "Running tests..."
go clean -testcache
go test -v -count=1 -cover -coverprofile=coverage.out ./*.go
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..."
# export PATH=$PATH:$(go env GOPATH)/bin
# staticcheck ./...
# @echo "Done!"
count:
@echo "Counting lines..."
bash count.sh public/count.svg ./*.go
@echo "Done!"
pre:
make build && make test && make format && make doc
git add .
clean:
go clean -i -x -cache -testcache -modcache
rm -rf coverage.out
rm -rf ./tmp