forked from contiv/netplugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchecks
More file actions
executable file
·68 lines (56 loc) · 1.25 KB
/
checks
File metadata and controls
executable file
·68 lines (56 loc) · 1.25 KB
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
#!/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.5.1"
maxVer="go1.5.1"
if [[ ${ver} < ${minVer} ]]; then
echo "!!! Go version check failed. Expected >=${minVer} but found ${ver}"
exit 1
fi
if [[ ${ver} > ${maxVer} ]]; then
echo "!!! Go version check failed. Expected =<${maxVer} 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 "+++ golint tree..."
for i in ${BUILD_PKGS}
do
tmp="$(golint ${i})"
if [ -n "$tmp" ]
then
lintOutput="${lintOutput}\n${tmp}" # golint has no exit codes
fi
done
if [ -n "${lintOutput}" ]
then
echo -e "!!! golint checking failed:\n${lintOutput}\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