-
Notifications
You must be signed in to change notification settings - Fork 739
*: enable bodyclose linter #4437
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
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
ref tikv#4322 Signed-off-by: Ryan Leung <rleungx@gmail.com>
54973a8
to
158ebbf
Compare
Codecov Report
@@ Coverage Diff @@
## master #4437 +/- ##
==========================================
+ Coverage 74.71% 74.90% +0.18%
==========================================
Files 263 263
Lines 27629 27678 +49
==========================================
+ Hits 20642 20731 +89
+ Misses 5130 5109 -21
+ Partials 1857 1838 -19
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
server/api/util.go
Outdated
res, err := client.Do(req) | ||
if err != nil { | ||
return nil, err | ||
return http.StatusInternalServerError, 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.
can we return 0, err
here?
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.
The caller will get 0 as the status code which is not good. I think an alternative is to return the status code according to the detailed error. But I'm going to leave it for now since it could happen rarely.
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.
0 is ok to use as an invalid status code when err is not nil. If you construct status code in client side, we cannot distiguish the cases that we receive the status code from server or construct it from client.
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.
Make sense, change to 0.
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.
The rest LGTM.
@@ -70,6 +70,7 @@ func (s *serverTestSuite) TestReconnect(c *C) { | |||
if name != leader { | |||
res, e := http.Get(s.GetConfig().AdvertiseClientUrls + "/pd/api/v1/version") | |||
c.Assert(e, IsNil) | |||
res.Body.Close() |
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 not defer
?
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.
It's a for loop, closing it directly is better.
Signed-off-by: Ryan Leung <rleungx@gmail.com>
/run-unit-tests |
/merge |
@rleungx: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 0819a58
|
Signed-off-by: Ryan Leung rleungx@gmail.com
What problem does this PR solve?
ref #4322
What is changed and how it works?
Enable bodyclose linter.
Check List
Tests
Release note