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: add static analysis to find deprecated reflect.{SliceHeader,StringHeader} that could be replaced by unsafe.{Slice,SliceData,String,StringData} #54989

Closed
cuiweixie opened this issue Sep 10, 2022 · 5 comments

Comments

@cuiweixie
Copy link
Contributor

cuiweixie commented Sep 10, 2022

when proposal is done, the reflect.{SliceHeader,StringHeader} will be deprecated.
I think we can add static check for our user to find the deprecated code that can be replace by unsafe.{Slice,SliceData,String,StringData}

@gopherbot gopherbot added this to the Proposal milestone Sep 10, 2022
@tklauser
Copy link
Member

Note that staticcheck already has check SA1019 for functions which are marked as deprecated in the doc comment. Once reflect.{Slice,String}Header have such a comment, staticcheck should automatically flag their usage as deprecated. Thus, I don't think a dedicated static checker is needed.

@rsc
Copy link
Contributor

rsc commented Oct 12, 2022

It should be the case that all uses of reflect.SliceHeader and StringHeader can be replaced, so the analysis is trivial.

Also, vet does not in general report "Deprecated" uses, although other tools do, including gopls I believe. We should probably just rely on those other tools.

@rsc
Copy link
Contributor

rsc commented Oct 12, 2022

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

@rsc
Copy link
Contributor

rsc commented Oct 20, 2022

Based on the discussion above, this proposal seems like a likely decline.
— rsc for the proposal review group

@rsc
Copy link
Contributor

rsc commented Oct 26, 2022

No change in consensus, so declined.
— rsc for the proposal review group

@rsc rsc closed this as completed Oct 26, 2022
@golang golang locked and limited conversation to collaborators Oct 26, 2023
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

4 participants