-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.sh
executable file
·53 lines (43 loc) · 1.29 KB
/
run-tests.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
49
50
51
52
53
#!/bin/sh
# Install the lint-tool, and the shadow-tool
go get -u golang.org/x/lint/golint
go get -u golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
go get -u honnef.co/go/tools/cmd/staticcheck
# Run the static-check tool - we ignore errors relating to case
t=$(mktemp)
staticcheck -checks all ./... | grep -v ALL_CAPS > $t
if [ -s $t ]; then
echo "Found errors via 'staticcheck':"
cat $t
rm $t
exit 1
fi
rm $t
# At this point failures cause aborts
set -e
# Run the linter
echo "Launching linter .."
#
# We have a bunch of errors which we need to mask
#
# opcode/opcode.go:8:2: don't use ALL_CAPS in Go names; use CamelCase
# opcode/opcode.go:11:2: don't use ALL_CAPS in Go names; use CamelCase
# opcode/opcode.go:14:2: don't use ALL_CAPS in Go names; use CamelCase
# opcode/opcode.go:17:2: don't use ALL_CAPS in Go names; use CamelCase
# opcode/opcode.go:20:2: don't use ALL_CAPS in Go names; use CamelCase
#
( golint ./... | grep -v ALL_CAPS > lint.out ) || true
if [ -s lint.out ]; then
echo "Linter errors: "
cat lint.out
exit 0
else
rm lint.out
fi
echo "Completed linter .."
# Run the shadow-checker
echo "Launching shadowed-variable check .."
go vet -vettool=$(which shadow) ./...
echo "Completed shadowed-variable check .."
# Run golang tests
go test ./...