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
x/tools/gopls: unusedparams
should ignore unused params in functions satisfying the http.HandlerFunc
type
#44152
Comments
Don't people use cc @stamblerre |
Yes, some do, but this isn't strictly enforced by the compiler. I don't believe that |
unusedparams
should ignore unused params in functions satisfying the http.HandlerFunc
typeunusedparams
should ignore unused params in functions satisfying the http.HandlerFunc
type
I don't think we should use |
I think there are benefits to leaving this diagnostic for unused parameters, even in In this case, the Generally, I think the
To add to that, there is a nontrivial cost to keeping a list of signatures that are exempted from unused params diagnostics, both in terms of maintenance, and in terms of the cognitive overhead for users, who may be confused by a missing diagnostic. Based on this, I think we will likely decline to make this change. |
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Share the Go related settings you have added/edited
Describe the bug
With code like the below example, where a function (
previewHandler
) satisfies thehttp.HanderlFunc
type, but does not use or modify thehttp.Request
(second argument), theunusedparams
analyzer included withgopls
should not warn on the issue.The text was updated successfully, but these errors were encountered: