-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
travis: add staticcheck #1019
travis: add staticcheck #1019
Conversation
OK, this is green. |
@iamqizhao could you take a look? |
@menghanl this is rebased and green again. |
@menghanl ping. |
@tamird, would you mind resolving the conflicts and then re-assigning this to me? We'd like to move ahead with this. |
@dfawley Done. I can't reassign to you because my privileges are insufficient. |
@@ -2844,7 +2845,8 @@ func testStreamsQuotaRecovery(t *testing.T, e env) { | |||
defer wg.Done() | |||
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 314) | |||
if err != nil { | |||
t.Fatal(err) | |||
t.Error(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a te.cancel() here is necessary to avoid a hang in the main goroutine. You could test this by changing it to if err == nil
above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would the main goroutine hang? It only waits on the waitgroup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, comment in the wrong place..
@dfawley ping. |
test/end2end_test.go
Outdated
@@ -2433,7 +2433,8 @@ func testMetadataStreamingRPC(t *testing.T, e env) { | |||
|
|||
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, int32(reqSizes[index])) | |||
if err != nil { | |||
t.Fatal(err) | |||
t.Error(err) | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where I meant to leave that comment.
Maybe defer stream.CloseSend() at the top of the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done.
@@ -2844,7 +2845,8 @@ func testStreamsQuotaRecovery(t *testing.T, e env) { | |||
defer wg.Done() | |||
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 314) | |||
if err != nil { | |||
t.Fatal(err) | |||
t.Error(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, comment in the wrong place..
Also only run golint and go vet in Go 1.8, and fix some vet failures.
server.go:824:3: the surrounding loop is unconditionally terminated (SA4004)
test/end2end_test.go:2409:2: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002) test/end2end_test.go:2843:3: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (SA2002)
benchmark/benchmark_test.go:85:3: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002) clientconn_test.go:299:2: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
The following violations are not fixed, because the code is a mess: transport/transport_test.go:208:5: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002) transport/transport_test.go:220:5: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002) transport/transport_test.go:226:5: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Yay! 🎉 |
staticcheck is a powerful static linter. See https://github.com/dominikh/go-staticcheck.
@iamqizhao