-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate.sh
More file actions
executable file
·48 lines (41 loc) · 839 Bytes
/
validate.sh
File metadata and controls
executable file
·48 lines (41 loc) · 839 Bytes
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
#!/usr/bin/env bash
#
# validate.sh runs various code analysis tools to reduce the likelihood of
# unnoticed errors
set -eu
err() {
echo $@ >&2
}
IFS=''
unformatted=$(find ./ -name "*.go" | xargs goimports -l)
linter=$(golint ./...)
vet=$(go vet -printfuncs Debugf,Infof,Warnf,Errorf,Criticalf,Fatalf ./... 2>&1 || true)
result=0
if [[ $unformatted != "" ]]; then
err "goimports reports issues:"
err "---------------------"
err $unformatted
result=1
fi
if [[ $linter != "" ]]; then
if [[ $result == 1 ]]; then
err
fi
err "linter reports issues:"
err "----------------------"
err $linter
result=1
fi
if [[ $vet != "" ]]; then
if [[ $result == 1 ]]; then
err
fi
err "go vet reports issues:"
err "----------------------"
err $vet
result=1
fi
if [[ $result == 1 ]]; then
err
fi
exit $result