From 1fb9f211ca936e09ebe487fcddc9e76a6919fd95 Mon Sep 17 00:00:00 2001 From: Ivan Kozlovic Date: Wed, 25 Jan 2017 13:30:11 -0700 Subject: [PATCH] Added gosimple - Get gosimple package - Updated staticcheck's URL - Moved build and above checks in `before_script` section to fail fast - Fixed reports from gosimple --- .travis.yml | 7 +++++-- server/server_test.go | 2 +- server/sublist.go | 5 +---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 270cb85e7f2..4f9c92e3b4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,13 +7,16 @@ install: - go get github.com/nats-io/go-nats - go get github.com/mattn/goveralls - go get github.com/wadey/gocovmerge -- go get honnef.co/go/staticcheck/cmd/staticcheck -script: +- go get honnef.co/go/tools/cmd/staticcheck +- go get honnef.co/go/tools/cmd/gosimple +before_script: - EXCLUDE_VENDOR=$(go list ./... | grep -v "/vendor/") - go build - go fmt ./... - go vet $EXCLUDE_VENDOR +- gosimple $EXCLUDE_VENDOR - staticcheck -ignore "$(cat staticcheck.ignore)" $EXCLUDE_VENDOR +script: - go test -i -race $EXCLUDE_VENDOR - go test -v -race $EXCLUDE_VENDOR after_success: diff --git a/server/server_test.go b/server/server_test.go index 66053b5741e..4b2f1352025 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -308,7 +308,7 @@ func TestWriteDeadline(t *testing.T) { t.Fatalf("Error on publish: %v", err) } } - dur := time.Now().Sub(start) + dur := time.Since(start) // user more than the write deadline to account for calls // overhead, running with -race, etc... if dur > 100*time.Millisecond { diff --git a/server/sublist.go b/server/sublist.go index c03fb1a8762..6dae92ca241 100644 --- a/server/sublist.go +++ b/server/sublist.go @@ -636,8 +636,5 @@ func matchLiteral(literal, subject string) bool { li++ } // Make sure we have processed all of the literal's chars.. - if li < ll { - return false - } - return true + return li >= ll }