Merge #28: Travis CI: Run gometalinter.

4c47444 Travis CI: Run gometalinter. (JeremyRand)

Pull request description:

  All the gometalinter linters that produce warnings with the current codebase are configured to not fail the Travis build, but their output will still be printed to Travis logs.  Other linters will fail the Travis build.

Tree-SHA512: 8e9e17390b28cc9997ce35692c64cee10ebca4e96a8b0ad1666bd83c707ba5c791207526fc05a2b4631bc9cdad8fed7637d42e0f548d22972bdfb3c670c8b6d9
pull/30/head
JeremyRand 7 years ago
commit 6ae122309b
No known key found for this signature in database
GPG Key ID: B3F2D165786D6570

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v1
go test -v ./... go test -v ./...
RESULT=$? RESULT=$?
@ -10,6 +10,44 @@ if [ "$RESULT" != "0" ]; then
return $RESULT return $RESULT
fi fi
# Static analysis
gometalinter.v1 --install
echo ""
echo "gometalinter critical (should be no warnings):"
gometalinter.v1 --enable-all \
--disable=aligncheck \
--disable=deadcode \
--disable=dupl \
--disable=errcheck \
--disable=gas \
--disable=gocyclo \
--disable=gofmt \
--disable=goimports \
--disable=golint \
--disable=gosimple \
--disable=gotype \
--disable=ineffassign \
--disable=lll \
--disable=misspell \
--disable=staticcheck \
--disable=unconvert \
--disable=unparam \
--disable=unused \
--concurrency=3 \
--deadline=10m \
./...
STATICRESULT1=$?
echo ""
echo "gometalinter non-critical (warnings expected):"
gometalinter.v1 --enable-all \
--concurrency=3 \
--deadline=10m \
./...
STATICRESULT2=$?
# Test cross-compilation. The binaries produced are also used for release # Test cross-compilation. The binaries produced are also used for release
# upload in after_success if this is a release tag. # upload in after_success if this is a release tag.
@ -29,6 +67,8 @@ RESULT2=$?
echo cgo crosscompile exited with code $RESULT1 echo cgo crosscompile exited with code $RESULT1
echo non-cgo crosscompile exited with code $RESULT2 echo non-cgo crosscompile exited with code $RESULT2
echo critical gometalinter exited with code $STATICRESULT1
echo non-critical gometalinter exited with code $STATICRESULT2
if [ "$RESULT1" != "0" ]; then if [ "$RESULT1" != "0" ]; then
return $RESULT1 return $RESULT1
@ -36,3 +76,6 @@ fi
if [ "$RESULT2" != "0" ]; then if [ "$RESULT2" != "0" ]; then
return $RESULT2 return $RESULT2
fi fi
if [ "$STATICRESULT1" != "0" ]; then
return $STATICRESULT1
fi

Loading…
Cancel
Save