-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.sh
More file actions
executable file
·40 lines (37 loc) · 878 Bytes
/
Copy pathscripts.sh
File metadata and controls
executable file
·40 lines (37 loc) · 878 Bytes
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
#!/usr/bin/env bash
runTests() {
if ! go vet .; then
exit 1
fi
if ! golint -set_exit_status .; then
exit 1
fi
if ! gocritic check -enable='#diagnostic,#style,#performance' -disable='docStub' .; then
exit 1
fi
if ! gocyclo -over 15 .; then
exit 1
fi
if ! go test -cover -race -coverprofile=cover.out -outputdir=coverage .; then
exit 1
fi
if ! go tool cover -html=./coverage/cover.out -o ./coverage/cover.out.html; then
exit 1
fi
}
COMMAND=$1
case "$COMMAND" in
test )
runTests ;;
benchmark )
go test -benchmem -cpuprofile=cpu.out -memprofile=mem.out -outputdir=coverage -bench .
go tool pprof -svg coverage/cpu.out > coverage/cpu.out.svg
go tool pprof -svg coverage/mem.out > coverage/mem.out.svg
;;
* )
echo
echo "Commands"
echo "test - run tests"
echo "benchmark - run test benchmarks"
;;
esac