From e4bb7b5b35e886701f89ca9cdab385c866cef345 Mon Sep 17 00:00:00 2001 From: Bora Alper Date: Fri, 3 Aug 2018 13:11:36 +0300 Subject: [PATCH] fixed .travis.yml (4) --- .travis.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f4219b..4aaa655 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,14 @@ script: - "go vet github.com/boramalper/magnetico/pkg/persistence/..." # Formatting Errors - - "gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/cmd/magneticod/" - - "gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/cmd/magneticow/" - - "gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/pkg/persistence/" + # + # Since gofmt returns zero even if there are files to be formatted, we use: + # + # ! gofmt -d ${GOPATH}/path/ 2>&1 | read + # + # to return 1 if there are files to be formatted, and 0 if not. + # + # https://groups.google.com/forum/#!topic/Golang-Nuts/pdrN4zleUio + - "! gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/cmd/magneticod/ 2>&1 | read" + - "! gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/cmd/magneticow/ 2>&1 | read" + - "! gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/pkg/persistence/ 2>&1 | read"