-
Notifications
You must be signed in to change notification settings - Fork 106
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
chore(*): migrate to golangci-lint #289
Conversation
/cc @kdada |
@@ -206,6 +206,8 @@ func (c *response) Flush() { | |||
} | |||
|
|||
// CloseNotify is a disguise of http.response.CloseNotify(). | |||
// | |||
// Deprecated: use `http.Request.Context.Done()` as instead. | |||
func (c *response) CloseNotify() <-chan bool { |
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 implementation is not correct. This method makes users have no way to check if the response supports http.CloseNotifier. Do you have time to fix this in a new PR?
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.
So I deleted it directly in this PR? As mentioned in #288
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 mean that the response may not implement http.CloseNotifier
.
The method should be separated into two parts:
type response struct {...}
type responseWithCloseNotify struct {
*response
}
func (c *responseWithCloseNotify) CloseNotify() <-chan bool {...}
Then wrap response with the new struct.
rw = &response{}
if _, ok:=rw.(http.CloseNotifier); ok {
rw = &responseWithCloseNotify{rw}
}
If the method is removed from the go library in the future, the response
still works.
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.
You mean still keep this function? As you replied Just do it.
in #288 I thought we can just delete this 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.
It seems that we need to retain it because of the behavior of go library.
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.
Fine, I will fix this in a new PR
LGTM for the rest. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kdada The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
close #287
Which issue(s) this PR is related to (optional, link to 3rd issue(s)):
Fixes #
Reference to #
Special notes for your reviewer:
/cc @your-reviewer
Release note: