forked from contiv-experimental/objmodel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchecks
executable file
·47 lines (37 loc) · 843 Bytes
/
checks
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
#!/bin/bash
#performs basic dev and build environment checks
USAGE="Usage: $0 <build packages>"
if [ $# -ne 1 ]; then
echo $USAGE
exit 1
fi
BUILD_PKGS=$1
echo "+++ Checking Go version..."
ver=$(go version | awk '{print $3}')
minVer="go1.4"
if [[ ${ver} < ${minVer} ]]; then
echo "!!! Go version check failed. Expected >=${minVer} but found ${ver}"
exit 1
fi
echo "+++ Checking gofmt..."
fmtRes=$(gofmt -l $BUILD_PKGS)
if [ -n "${fmtRes}" ]; then
echo -e "!!! gofmt checking failed:\n${fmtRes}\n"
exit 1
fi
echo "+++ go vet tree..."
for i in ${BUILD_PKGS}
do
tmp="$(go vet ${i} 2>&1)"
if [ -n "$tmp" ]
then
vetOutput="${vetOutput}\n${tmp}"
fi
done
if [ -n "${vetOutput}" ]
then
echo -e "!!! go vet checking failed:\n${vetOutput}\n"
exit 1
fi
echo "+++ All checks passed!!"
exit 0