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

unused: flag unused arguments #124

Open
gyuho opened this issue Jun 20, 2017 · 5 comments
Open

unused: flag unused arguments #124

gyuho opened this issue Jun 20, 2017 · 5 comments

Comments

@gyuho
Copy link

gyuho commented Jun 20, 2017

Could unused flag unused function arguments?

e.g.

func hello(v int) {
    println(1)
}
// complains that 'v' is not used.

c.f. etcd-io/etcd#8068

And thanks for the great tool!

@mvdan
Copy link
Contributor

mvdan commented Jun 20, 2017

This is an inherently incorrect science, and false positives are likely. I believe this was discarded for unused on purpose. I've written unparam for this, which does an okay job.

@dominikh
Copy link
Owner

What mvdan said.

@ainar-g
Copy link
Contributor

ainar-g commented Jul 25, 2018

I know that this issue has been closed for over a year now, and that the official response is "Just use unparam!", but I would like to add some input, as a heavy user of megacheck.

Unused parameters often occur during a refactoring/rapid prototyping. Often, they mask bugs, that will only be discovered at test time (or even production). I would assume that a tool called unused finds unused parameters as well, even if it's behind a flag like -exported, but it doesn't. At all. I already have four tools that I use on every project (six, if you count megacheck as three tools). Adding another one for a feature that unused is missing doesn't sound right.

I don't mean any disrespect towards @mvdan, but I really think this should be a part of unused.

@dominikh
Copy link
Owner

I'll reconsider it for the rewrite of unused, although I'd be inclined to limit it to unexported functions only.

@jirfag
Copy link

jirfag commented Jul 26, 2018

@ainar-g 5 linters isn’t a problem: you can use gometalinter or similar tool: it makes running of even dozens of linters easy. And they will run in parallel by these tools.

@dominikh dominikh added the started Issues we've started working on label Jan 4, 2023
@dominikh dominikh removed the started Issues we've started working on label Feb 29, 2024
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

5 participants