forked from tsuru/gandalf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-fmt.sh
executable file
·53 lines (47 loc) · 1.13 KB
/
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
52
53
#!/bin/bash
# Copyright 2016 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.
# This script was copied from tsuru, that's why the Copyright note above refers
# to "tsuru authors" instead of "gandalf authors".
status=0
out=`gofmt -s -l . | grep -v vendor/`
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
# TODO(fss): uncomment this code when golang/go#13644 is fixed
# (https://github.com/golang/go/issues/13644).
#
# 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
out=`go tool vet -shadow -all . 2>&1 | grep -v vendor/`
if [ "${out}" != "" ]
then
echo "ERROR: go vet failures:"
echo
cat <<END
${out}
END
status=1
fi
exit $status