diff --git a/.travis.gofmt.sh b/.travis.gofmt.sh new file mode 100755 index 00000000..b9f906b8 --- /dev/null +++ b/.travis.gofmt.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +if [ -n "$(gofmt -s -l .)" ]; then + echo "Go code is not formatted:" + gofmt -s -d -e . + exit 1 +fi diff --git a/.travis.yml b/.travis.yml index fd784a3f..5c79321c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ before_install: - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then docker exec build bash -c "pushd codecovio_build; git fetch origin +refs/pull/${TRAVIS_PULL_REQUEST}/merge && git checkout -qf FETCH_HEAD; popd"; fi' script: - - docker exec build bash -c "export GOPATH=/codecovio_build && pushd codecovio_build/src && glide install --strip-vendor && cd caduceus && go build caduceus && go test -race -coverprofile=coverage.txt && popd" + - docker exec build bash -c "export GOPATH=/codecovio_build && pushd codecovio_build/src && glide install --strip-vendor && cd caduceus && go build caduceus && go test -race -coverprofile=coverage.txt && ../../.travis.gofmt.sh && popd" - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then docker exec build bash -c "pushd caduceus; ./build_rpm.sh; popd"; fi' after_success: