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

unsafe: automated conversion to unsafe.Add #48913

Open
zx2c4 opened this issue Oct 11, 2021 · 2 comments
Open

unsafe: automated conversion to unsafe.Add #48913

zx2c4 opened this issue Oct 11, 2021 · 2 comments
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@zx2c4
Copy link
Contributor

zx2c4 commented Oct 11, 2021

With the new functions added to unsafe for 1.17, it'd be nice if go fix or similar would be able to automatically rewrite older unsafe usage into the newer functions, such as unsafe.Add. It seems like existing tools like eg and rf lack the type system in order to handle the various integer types involved.

CC @rsc @mvdan @cuonglm @mdempsky

@cuonglm
Copy link
Member

cuonglm commented Oct 12, 2021

One thing to consider is performance, for example, unsafe.Slice is currently slower than corresponding pure unsafe usage: #48798

@zx2c4
Copy link
Contributor Author

zx2c4 commented Oct 12, 2021

Thanks, that's good to know and may well delay my own deployment of it. However, it's also something that might be fixed down the line. So in preparation for that, using the more fitting API seems like a good thing.

@ALTree ALTree added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Oct 12, 2021
@seankhliao seankhliao added this to the Unplanned milestone Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants