Skip to content
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

Merged
merged 2 commits into from
Aug 29, 2019
Merged

Conversation

iawia002
Copy link

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:

NONE

@caicloud-bot caicloud-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. caicloud-cla: yes Indicates the PR's author has not signed the Caicloud CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 23, 2019
@iawia002 iawia002 changed the title WIP: chore(*): migrate to golangci-lint chore(*): migrate to golangci-lint Aug 23, 2019
@caicloud-bot caicloud-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 23, 2019
@iawia002
Copy link
Author

/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 {
Copy link
Collaborator

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?

Copy link
Author

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

Copy link
Collaborator

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.

Copy link
Author

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.

Copy link
Collaborator

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.

Copy link
Author

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

@kdada
Copy link
Collaborator

kdada commented Aug 26, 2019

LGTM for the rest.

@kdada
Copy link
Collaborator

kdada commented Aug 29, 2019

/lgtm

@caicloud-bot caicloud-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 29, 2019
@caicloud-bot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@caicloud-bot caicloud-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 29, 2019
@caicloud-bot caicloud-bot merged commit 041ed69 into caicloud:master Aug 29, 2019
@iawia002 iawia002 deleted the lint branch August 29, 2019 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. caicloud-cla: yes Indicates the PR's author has not signed the Caicloud CLA. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

migrate to golangci-lint
3 participants