Add Travis check for Gofmt.

This commit is contained in:
Victor Marmol 2015-01-05 11:28:06 -08:00
parent 643d647761
commit 60c6e070a5
2 changed files with 21 additions and 1 deletions

View File

@ -11,6 +11,7 @@ before_script:
- sudo service influxdb start
script:
- export PATH=$PATH:$HOME/gopath/bin
- ./deploy/check_gofmt.sh .
- go vet github.com/google/cadvisor/...
- godep go test -v -race -test.short github.com/google/cadvisor/...
- godep go build github.com/google/cadvisor
- go vet github.com/google/cadvisor/...

19
deploy/check_gofmt.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
# Check usage.
if [ $# -ne 1 ]; then
echo "USAGE: check_gofmt <source directory>"
exit 1
fi
# Check formatting on non Godep'd code.
GOFMT_PATHS=$(find . -not -wholename "*.git*" -not -wholename "*Godeps*" -not -name "." -type d)
# Find any files with gofmt problems
BAD_FILES=$(gofmt -s -l $GOFMT_PATHS)
if [ -n "$BAD_FILES" ]; then
echo "The following files are not properly formatted:"
echo $BAD_FILES
exit 1
fi