forked from adshao/go-binance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.sh
executable file
·48 lines (41 loc) · 876 Bytes
/
check.sh
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
#!/bin/bash
set -e
ACTION=$1
function format() {
echo "Running gofmt ..."
if [[ $1 == "-w" ]]; then
gofmt -w $(find . -type f -name '*.go' -not -path "./vendor/*")
elif [[ $1 == "-l" ]]; then
gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*")
else
test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*"))"
fi
}
function lint() {
echo "Running golint ..."
go install golang.org/x/lint/golint
golint -set_exit_status ./...
}
function vet() {
echo "Running go vet ..."
(
cd v2
go vet ./...
)
}
function unittest() {
echo "Running go test ..."
(
cd v2
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
)
}
if [[ -z $ACTION ]]; then
format
# lint
vet
unittest
else
shift
$ACTION "$@"
fi