Check files with go fmt in CI

This commit is contained in:
Dan Sosedoff 2018-03-16 19:59:58 -05:00
parent d72f1c85c1
commit a02c813784
2 changed files with 14 additions and 0 deletions

View File

@ -20,6 +20,7 @@ env:
- GO15VENDOREXPERIMENT=1
before_install:
- ./script/check_formatting.sh
- ./script/check_assets.sh
install:

13
script/check_formatting.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
files="$(go fmt ./...)"
ignore="pkg/data/bindata.go"
files=${files[@]/$ignore}
if [ -n "$files" ]; then
echo "Go code is not formatted: $files"
for file in $files; do
echo "----> $file"
done
exit 1
fi