From 645529243fe8a4855265e5d27bdd005f2cd34c0e Mon Sep 17 00:00:00 2001 From: Ivan Kozlovic Date: Tue, 15 Nov 2016 12:54:36 -0700 Subject: [PATCH] Fix staticcheck reported issues The tool is started with the "-ignore" flag to ignore warning SA2002 which corresponds to invoking t.Fatalf (and the like) in a go routine. Calling t.Fatalf in a go routine may produce a race condition. The rationale for ignoring this warning is that if a test executes the t.Fatalf() line it is that we have a problem either with test or code that should be fixed. --- .travis.yml | 2 +- test/monitor_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2be97a97..71d4b894 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ script: - go vet ./... - go test -i -race ./... - go test -v -race ./... -- staticcheck ./... +- staticcheck -ignore="github.com/nats-io/gnatsd/*/*_test.go:SA2002" ./... after_script: - if [ "$TRAVIS_GO_VERSION" = "1.7.3" ]; then ./scripts/cov.sh TRAVIS; fi - if [ "$TRAVIS_GO_VERSION" = "1.7.3" ] && [ "$TRAVIS_TAG" != "" ]; then ./scripts/cross_compile.sh $TRAVIS_TAG; ghr --username nats-io --token $GITHUB_TOKEN --replace $TRAVIS_TAG pkg/; fi diff --git a/test/monitor_test.go b/test/monitor_test.go index a1da1f0b..176b99c6 100644 --- a/test/monitor_test.go +++ b/test/monitor_test.go @@ -540,7 +540,7 @@ func TestHTTPHost(t *testing.T) { func createClientConnSubscribeAndPublish(t *testing.T) net.Conn { cl := createClientConn(t, "localhost", CLIENT_PORT) - send := sendCommand(t, cl) + sendCommand(t, cl) send, expect := setupConn(t, cl) expectMsgs := expectMsgsCommand(t, expect)