Replies: 3 comments 3 replies
-
Use revive linter |
Beta Was this translation helpful? Give feedback.
1 reply
-
I think this is a not so straightforward topic. #4819 (comment) Some context on which linters detects what and which ones are deprecated can be found in #1841. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Try to use https://pkg.go.dev/golang.org/x/tools/cmd/deadcode. I find it useful sometimes. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to get a warning if my code has unused exported functions/variables/constants/types.
Afaik the linters "staticcheck" and "unused" do not support that.
There is
deadcode
, but it is deprecated and does only check for functions (not variables/constants/types). Afaikdeadcode
only detect unused functions (not variables/constants/types).If something is exported, it should be tested.
If it is tested, then it is used, and the linter I am looking for would not complain.
I don't want it to be enabled by default. But for projects where test coverage is mandatory, I want to enable it.
Beta Was this translation helpful? Give feedback.
All reactions