forked from tsuru/tsuru
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-fmt.sh
executable file
·51 lines (45 loc) · 899 Bytes
/
check-fmt.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
#!/bin/bash
# Copyright 2014 tsuru authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
status=0
out=`gofmt -s -l .`
if [ "${out}" != "" ]
then
echo "ERROR: there are files that need to be formatted with gofmt"
echo
echo "Files:"
for file in $out
do
echo "- ${file}"
done
echo
status=1
fi
go get golang.org/x/tools/cmd/goimports
out=`goimports -l .`
if [ "${out}" != "" ]
then
echo "ERROR: there are files that need to be formatted with goimports"
echo
echo "Files:"
for file in $out
do
echo "- ${file}"
done
status=1
fi
go get golang.org/x/tools/cmd/vet
`go vet ./... > .vet 2>&1`
out=`cat .vet`
if [ "${out}" != "" ]
then
echo "ERROR: go vet failures:"
echo
cat <<END
${out}
END
status=1
fi
rm .vet || true
exit $status