forked from furkansenharputlu/f-license
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·38 lines (28 loc) · 670 Bytes
/
test.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
#!/bin/bash
set -e
# print a command and execute it
show() {
echo "$@" >&2
eval "$@"
}
fatal() {
echo "$@" >&2
exit 1
}
GOFILES=$(find * -name '*.go' -not -path 'vendor/*' -not -name 'bindata.go')
echo "Formatting checks..."
FMT_FILES="$(gofmt -s -l $GOFILES)"
if [[ -n $FMT_FILES ]]; then
fatal "Run 'gofmt -s -w' on these files:\n$FMT_FILES"
fi
echo "gofmt check is ok!"
IMP_FILES="$(goimports -l $GOFILES)"
if [[ -n $IMP_FILES ]]; then
fatal "Run 'goimports -w' on these files:\n$IMP_FILES"
fi
echo "goimports check is ok!"
for pkg in $(go list github.com/furkansenharputlu/f-license/...);
do
echo "Testing... $pkg"
go test -race -v $pkg
done