bodyclose icon indicating copy to clipboard operation
bodyclose copied to clipboard

Analyzer: checks whether HTTP response body is closed and a re-use of TCP connection is not blocked.

Results 37 bodyclose issues
Sort by recently updated
recently updated
newest added

The current version of `bodyclose` only run analysis on `http.Response`. It's quite common that people use the same behaviour on `http.Request` (on server side) which is not really necessary. According...

Please use [semantic versioning](https://semver.org/) with tags, like this: ```bash $ git tag v0.0.1 $ git push origin v0.0.1 # ... * [new tag] v0.0.1 -> v0.0.1 ``` So we can...

Hello, the following code is good, but **bodyclose** finds it bad: ```diff $ git diff diff --git a/passes/bodyclose/testdata/src/a/a.go b/passes/bodyclose/testdata/src/a/a.go index dcf9448..da0c7cd 100644 --- a/passes/bodyclose/testdata/src/a/a.go +++ b/passes/bodyclose/testdata/src/a/a.go @@ -2,6 +2,7 @@...

Hello, bodyclose doesn't detect body not closed when we don't use defer. With this two case: First one is not problematic (because we can easily use `defer res.Body.Close()`: ```go func...

To make development and adding new features easier

Have you come across this article - http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/index.html#close_http_resp_body ? The code examples could be improved as per the suggestions in the article.

example: ```go package p import "io" // CloseSilently ... func CloseSilently(c io.Closer) { _ = c.Close() } ``` ```go package main import ( "net/http" "p" ) func main() { resp,...

```go package main import ( "net/http" ) type myCloser interface { Close() error } func closeBody(c myCloser) { _ = c.Close() } func main() { resp, _ := http.Get("https://example.com") defer...

We experienced a crash of one of our production services a couple of weeks ago due to an un-closed HTTP response body. This change covers more cases which would have...

Currently, SSA is not working with generics. So your linter produces a panic when it is used with generics. There is an issue open about that in the Go repository:...