-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathchecks_in_container.sh
executable file
·78 lines (66 loc) · 1.47 KB
/
checks_in_container.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
set -e
export PATH="/go/bin:$PATH"
echo "Formatting all shell scripts..."
find . -type f -name "*.sh" -and -not -path "./vendor/*" -and -not -path "./build/dependencies/*" -print0 | xargs -0 shfmt -w
dirs=$(go list ./... | sed -e 's!github.com/contiv/auth_proxy!.!g' | grep -v ./vendor)
files=$(find . -type f -name '*.go' | grep -v ./vendor)
echo "Running gofmt..."
set +e
out=$(gofmt -s -l ${files})
set -e
if [ "${#out}" -gt 0 ]; then
echo 1>&2 "gofmt errors in:"
echo 1>&2 "${out}"
exit 1
fi
echo "Running ineffassign..."
for i in ${dirs}; do
ineffassign $i
done
echo "Running golint..."
set +e
out=$(golint ./... | grep -vE '^vendor')
set -e
if [ "${#out}" -gt 0 ]; then
echo 1>&2 "golint errors in:"
echo 1>&2 "${out}"
echo "${out}"
exit 1
fi
echo "Running govet..."
set +e
out=$(go tool vet -composites=false ${dirs} 2>&1 | grep -v vendor)
set -e
if [ "${#out}" -gt 0 ]; then
echo 1>&2 "go vet errors in:"
echo 1>&2 "${out}"
exit 1
fi
echo "Running gocyclo..."
set +e
out=$(gocyclo -over 15 . | grep -v vendor)
set -e
if [ "${#out}" -gt 0 ]; then
echo 1>&2 "gocyclo errors in:"
echo 1>&2 "${out}"
exit 1
fi
echo "Running misspell..."
set +e
out=$(misspell -locale US -error -i exportfs ${files})
set -e
if [ "${#out}" -gt 0 ]; then
echo 1>&2 "misspell errors in:"
echo 1>&2 "${out}"
exit 1
fi
echo "Running deadcode..."
set +e
out=$(deadcode ${dirs} 2>&1)
set -e
if [ "${#out}" -gt 0 ]; then
echo 1>&2 "deadcode errors in:"
echo 1>&2 "${out}"
exit 1
fi