-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
feat: add reuseconn linter #3464
base: master
Are you sure you want to change the base?
Conversation
Hey, thank you for opening your first Pull Request ! |
In order for a pull request adding a linter to be reviewed, the linter and the PR must follow some requirements. Pull Request Description
Linter
The Linter Tests Inside Golangci-lint
|
@atzoum, hello! Cool, but why not contribute in
|
Hi @Antonboom! The reason why That being said, the reuseconn linter promotes the following pattern
With respect to the possibility of extending the original cc @timakin |
Hi team, please let me know if there is anything need to be done from my side in order to move this pull request forward |
I was also curious why this wasn't PRed upstream to |
@timakin do you see this as a possibility, merging the 2 linters into one? |
btw
If (2) was possible I could compile my own binary with my private linter bundled and use it without bothering you 😄 |
I'm on the same side as @bombsimon . I'll be appreciated it if @atzoum opened PR to |
Checking whether a connection can be reused entails making sure that the body is both consumed and closed. Thus, there will always be some overlapping between I will try to prepare a pull request, however based on my comment here, it is not really straightforward to achieve this for all scenarios that @timakin if you have any better idea for implementing this please go ahead |
|
||
import ( | ||
"io" | ||
"io/ioutil" |
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.
Please use io
instead of deprecated ioutil
.
@@ -187,3 +187,5 @@ require ( | |||
gopkg.in/yaml.v2 v2.4.0 // indirect | |||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect | |||
) | |||
|
|||
require github.com/atzoum/reuseconn v0.1.0 // indirect |
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.
Should this be moved up into the existing block of indirect required modules?
https://github.com/atzoum/reuseconn
reuseconn
is a linter that checks whether the HTTP response body is consumed and closed properly in a single function, so that the underlying TCP connection can be reused.This linter is a fork of timakin/bodyclose with the additional goal to address the rule that is clearly described in the GoDoc of http.Response and requires that the body should be both read to completion and closed so that the underlying TCP connection can be successfully reused.