-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
run-tests.sh
executable file
·48 lines (39 loc) · 1.06 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
#!/bin/sh
# I don't even ..
go env -w GOFLAGS="-buildvcs=false"
# Install the tools we use to test our code-quality.
#
# Here we setup the tools to install only if the "CI" environmental variable
# is not empty. This is because locally I have them installed.
#
# NOTE: Github Actions always set CI=true
#
if [ -n "${CI}" ] ; then
go install golang.org/x/lint/golint@latest
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
fi
# Run the static-check tool.
t=$(mktemp)
staticcheck -checks all ./... > "$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 .."
golint -set_exit_status ./...
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 ./...
# Run our functionality tests
./test.sh