Run go fmt in CI

This commit is contained in:
Cameron Sparr 2015-10-16 12:54:05 -06:00
parent 0986caf0ad
commit 97d4f9e0ff
4 changed files with 25 additions and 13 deletions

View File

@ -75,7 +75,7 @@ func TestPostgresqlGeneratesMetrics(t *testing.T) {
} }
assert.True(t, metricsCounted > 0) assert.True(t, metricsCounted > 0)
assert.Equal(t, len(availableColumns) - len(p.IgnoredColumns()), metricsCounted) assert.Equal(t, len(availableColumns)-len(p.IgnoredColumns()), metricsCounted)
} }
func TestPostgresqlTagsMetricsWithDatabaseName(t *testing.T) { func TestPostgresqlTagsMetricsWithDatabaseName(t *testing.T) {

View File

@ -22,6 +22,15 @@ function exit_if_fail {
fi fi
} }
# Check that go fmt has been run.
function check_go_fmt {
fmtcount=`git ls-files | grep '.go$' | grep -v Godep | xargs gofmt -l 2>&1 | wc -l`
if [ $fmtcount -gt 0 ]; then
echo "run 'go fmt ./...' to format your source code."
exit 1
fi
}
# build takes three arguments: GOOS & GOARCH & VERSION # build takes three arguments: GOOS & GOARCH & VERSION
function build { function build {
echo -n "=> $1-$2: " echo -n "=> $1-$2: "
@ -53,6 +62,9 @@ echo "\$CIRCLE_BRANCH: $CIRCLE_BRANCH"
exit_if_fail mv $HOME/telegraf $GOPATH/src/github.com/influxdb exit_if_fail mv $HOME/telegraf $GOPATH/src/github.com/influxdb
exit_if_fail cd $GOPATH/src/github.com/influxdb/telegraf exit_if_fail cd $GOPATH/src/github.com/influxdb/telegraf
# Verify that go fmt has been run
check_go_fmt
# Install the code # Install the code
exit_if_fail godep go build -v ./... exit_if_fail godep go build -v ./...
exit_if_fail godep go install -v ./... exit_if_fail godep go install -v ./...

View File

@ -3,8 +3,8 @@ package testutil
import ( import (
"fmt" "fmt"
"reflect" "reflect"
"time"
"sync" "sync"
"time"
) )
// Point defines a single point measurement // Point defines a single point measurement