diff --git a/.travis.yml b/.travis.yml index 9a20e18..d61829f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,7 @@ env: - GO15VENDOREXPERIMENT=1 before_install: + - ./script/check_formatting.sh - ./script/check_assets.sh install: diff --git a/script/check_formatting.sh b/script/check_formatting.sh new file mode 100755 index 0000000..e064638 --- /dev/null +++ b/script/check_formatting.sh @@ -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 \ No newline at end of file