mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Add go fmt
This commit is contained in:
committed by
Reed Allman
parent
9a7141967c
commit
81e39b210d
23
go-fmt.sh
Executable file
23
go-fmt.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#! /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
|
||||
Reference in New Issue
Block a user