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

x/tools/cmd/vet: warn about unused non-exported functions #4827

Closed
griesemer opened this issue Feb 16, 2013 · 16 comments
Closed

x/tools/cmd/vet: warn about unused non-exported functions #4827

griesemer opened this issue Feb 16, 2013 · 16 comments

Comments

@griesemer
Copy link
Contributor

It's common to leave dead functions in larger packages as a result of refactoring over
time. go vet could issue warnings (some functions we may want to leave for debugging).

More generally, this could apply to all top-level consts, types, vars, and funcs - at
least to some extent.
@griesemer
Copy link
Contributor Author

Comment 1:

I should have said "unexported" dead functions. It does require for go vet to run over
all files of a package.

@rsc
Copy link
Contributor

rsc commented Mar 12, 2013

Comment 2:

[The time for maybe has passed.]

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 4:

Labels changed: added priority-later, go1.2maybe, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 5:

Labels changed: added feature.

@robpike
Copy link
Contributor

robpike commented Aug 1, 2013

Comment 6:

Status changed to Started.

@robpike
Copy link
Contributor

robpike commented Aug 27, 2013

Comment 7:

Labels changed: removed go1.2maybe.

@robpike
Copy link
Contributor

robpike commented Aug 27, 2013

Comment 8:

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 9:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 10:

Labels changed: removed feature.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 11:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 12:

Labels changed: added repo-tools.

@mewmew
Copy link
Contributor

mewmew commented Mar 11, 2014

Comment 13:

This has probably been mentioned elsewhere, but I'll include a link here for future
reference.
Rémy has implemented some dead code detection at:
https://github.com/remyoudompheng/go-misc/blob/master/deadcode/deadcode.go

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/vet: warn about unused non-exported functions x/tools/cmd/vet: warn about unused non-exported functions Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@JayNakrani
Copy link
Contributor

Do we need this? If so, I could work on it in 1.9. Let me know.

@minux
Copy link
Member

minux commented Feb 12, 2017 via email

@robpike
Copy link
Contributor

robpike commented Feb 12, 2017

I think it's probably too hard to get the false positives rate low enough in the real world.

It might work as a lint check, which can be looser.

Closing.

@robpike robpike closed this as completed Feb 12, 2017
@rsc
Copy link
Contributor

rsc commented Feb 13, 2017

I think that might be too much even for lint, but if anyone does want this check,
https://github.com/dominikh/go-unused already does it.

@golang golang locked and limited conversation to collaborators Feb 13, 2018
@rsc rsc unassigned robpike Jun 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants