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

proposal: cmd/vet: Warn about usage of deprecated functions/types #50847

Closed
Simerax opened this issue Jan 27, 2022 · 4 comments
Closed

proposal: cmd/vet: Warn about usage of deprecated functions/types #50847

Simerax opened this issue Jan 27, 2022 · 4 comments
Labels
FrozenDueToAge Proposal WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@Simerax
Copy link

Simerax commented Jan 27, 2022

It would be convenient if go vet could report the usage of deprecated functions/types.
I think vet's exit code should still be zero per default even if anything is found because it's often something you can't just change right away.
Turning those warnings into errors could be controlled by a flag.

@gopherbot gopherbot added this to the Proposal milestone Jan 27, 2022
@ALTree
Copy link
Member

ALTree commented Jan 27, 2022

One the 3 vet's criteria is precision: if vet warns about it, it needs to be worth looking at, i.e. "an actual problem". Having calls to now deprecated functions in your codebase is not an issue per se, the deprecation notice it's more of a suggestion not to use the function in new code. I think this new warning has the potential to be very noisy on any large codebase.

@Simerax
Copy link
Author

Simerax commented Jan 27, 2022

I agree with you and maybe vet is not the right place for something like this. I do however think there is some potential in a command that gives you information about usage of deprecated things.
Yes deprecated does not mean you can't use it but it does mean "sooner or later we might drop this".
Being able to proactivley look for and clean up is useful in my opinion.

Maybe it's not something that should be shipped with go and instead be a third party tool - I don't know.

@seankhliao
Copy link
Member

staticcheck, and by extension, gopls, can check for it: https://staticcheck.io/docs/checks#SA1019

@ianlancetaylor ianlancetaylor added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 27, 2022
@Simerax
Copy link
Author

Simerax commented Jan 28, 2022

I guess the feature isn't wanted as much as I thought.
Thanks for pointing me to staticcheck @seankhliao.

Closing this.

@Simerax Simerax closed this as completed Jan 28, 2022
@golang golang locked and limited conversation to collaborators Jan 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Proposal WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants