Skip to content

New linter: punused for finding exported but unused symbols #3143

Closed
@Southclaws

Description

@Southclaws

Your feature request related to a problem? Please describe.

https://github.com/bep/punused

Sometimes, non-Go engineers or inexperienced Go engineers inadvertently export symbols by accident simply by naming them with uppercase. The unused/deadcode linters don't capture this as an exported symbol is considered part of the public API and thus not considered "unused".

But in applications (not libraries) this is problematic as deprecated functions can accumulate and it's unclear whether or not they are used in other parts of the code. punused solves this quite nicely and it would be great to see it added as part of the linters.

Describe the solution you'd like.

https://github.com/bep/punused be added and part of the deadcode linter group (though it's quite slow especially on large projects so probably best not to include it as a default or part of the "fast" category)

Describe alternatives you've considered.

I can't find any other projects that actually do dead code analysis on exported functions and symbols.

Additional context.

If I find the time and people are cool with this, I could draft a PR and implement it myself. As long as there are no issues, give me the green light here and I'll find some time to integrate it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions