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

staticcheck: flag looking for "use of closed network connection" in error strings in Go 1.16+ #817

Open
ainar-g opened this issue Aug 27, 2020 · 0 comments

Comments

@ainar-g
Copy link
Contributor

ainar-g commented Aug 27, 2020

Following golang/go#4373, programmers who want to check against errors about closed network connections should use errors.Is and not inspect the error text. So, in Go 1.16 and later this pattern (from the current code in golang.org/x/net/http2/server.go) should be flagged:

if strings.Contains(str, "use of closed network connection") {
	return true
}
@ainar-g ainar-g added the needs-triage Newly filed issue that needs triage label Aug 27, 2020
@dominikh dominikh added new-check and removed needs-triage Newly filed issue that needs triage labels Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants