Files
fn-serverless/go-fmt.sh
Denis Makogon 9a89366d1b Addressing review comments
reverting query string caching in favour of Go 1.9 sqlx features
 moving context definition out of call.End to upper level
2017-09-06 21:48:29 +03:00

24 lines
403 B
Bash
Executable File

#! /bin/sh
set -e
function listFilesExit () {
echo The following files need to have go fmt ran:
echo $NEED_TO_FORMAT
exit 1
}
FOLDERS=$(go list -f {{.Dir}} ./... | grep -v vendor)
for i in $FOLDERS
do
cd $i
FILES=$(ls *.go)
for j in $FILES
do
#echo $i/$j
ALL_FILES="$ALL_FILES $i/$j"
done
done
#echo $ALL_FILES
NEED_TO_FORMAT="$(gofmt -l $ALL_FILES)"
[[ -z $NEED_TO_FORMAT ]] || listFilesExit