Add Travis check for Gofmt.
This commit is contained in:
parent
643d647761
commit
60c6e070a5
@ -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
19
deploy/check_gofmt.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user