Skip to content

Conversation

@gsora
Copy link
Contributor

@gsora gsora commented May 10, 2019

This commit adds full support for bodyclose linter
(https://github.com/timakin/bodyclose), which checks if an http.Body
element is correctly closed after usage.

Since it can be used via go/analysis, I followed the govet example
as suggested by https://github.com/golangci/golangci-lint/wiki/How-to-add-a-custom-linter.

This commit is fully tested, and contains a (flawed) test program which
calls http.Get() on https://google.com and does not closes its
corresponding http.Body.

gsora added 2 commits May 11, 2019 00:21
This commit adds full support for bodyclose linter
(https://github.com/timakin/bodyclose), which checks if an `http.Body`
element is correctly closed after usage.

Since it can be used via `go/analysis', I followed the `govet' example
as suggested by https://github.com/golangci/golangci-lint/wiki/How-to-add-a-custom-linter.

This commit is fully tested, and contains a (flawed) test program which
calls `http.Get()' on `https://google.com' and does not closes its
corresponding `http.Body'.
@CLAassistant
Copy link

CLAassistant commented May 10, 2019

CLA assistant check
All committers have signed the CLA.

@gsora
Copy link
Contributor Author

gsora commented May 10, 2019

Uhm, I do run goimports through VSCode on save, I don't understand why those errors appear.

@alexkohler
Copy link

@gsora - Perhaps you're using an older version of goimports? It could possibly be the import order. Typically I think goimports does standard library imports first.

@gsora
Copy link
Contributor Author

gsora commented May 12, 2019

I checked and I'm using the latest version of golang.org/x/tools/cmd/goimports, which seems to be used by https://github.com/golangci/gofmt/blob/master/goimports/golangci.go too.

@jirfag
Copy link
Contributor

jirfag commented Jun 9, 2019

thank you for this contribution! it has some issues and I will fix them myself because it's my fault that it's being merged too long

@jirfag jirfag merged commit 78079be into golangci:master Jun 9, 2019
jirfag added a commit that referenced this pull request Jun 9, 2019
@ldez ldez added the linter: new Support new linter label Dec 7, 2020
@ldez ldez added this to the v1.17 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linter: new Support new linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants