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

Clarify what assumptions this package intends to protect #3

Closed
mdempsky opened this issue Dec 24, 2020 · 3 comments
Closed

Clarify what assumptions this package intends to protect #3

mdempsky opened this issue Dec 24, 2020 · 3 comments

Comments

@mdempsky
Copy link

Strictly speaking, cmd/compile already has a moving GC: stacks can grow and shrink, and variables that are stack allocated may have their address visibly change during runtime: https://play.golang.org/p/t3VX4YVDYYT

@kke
Copy link

kke commented Feb 9, 2023

As seen in the go 1.20 formula update PR for homebrew, a huge number of projects fail to build as some of their dependencies has decided to import this package. This has delayed the go 1.20 availability on brew for everyone. I think this does more harm than good.

It seems this has been imported from several packages that just happen to use unsafe "just in case", I believe the problem this repo is trying to anticipate involves some very specific use of unsafe and the people who have imported this do not understand what this repo is trying to do either.

This @mdempsky 's question has gone unanswered for two years.

I would advise everyone to not depend on this package unless they very clearly and exactly understand what the problem is they're trying to solve by importing this.

@bradfitz
Copy link
Contributor

bradfitz commented Feb 9, 2023

It specifically is about moving GC of heap-allocated objects, not things on the stack.

This package was made specifically for go4.org/intern which was needed by inet.af/netaddr before it was in the standard library as net/netip. It gave us some peace of mind that if we got distracted and didn't finish that project/migration and left it in some intermediate state, we wouldn't be responsible for random memory corruption in somebody's project 5 years down the road. It was better for lack of effort on our part to cause a build breakage than corruption.

Any package depending on this is package is suspect and probably playing stupid games. I think the cost of having to go get @upgrade this package occasionally is useful for keeping an eye on those suspect packages.

@bradfitz
Copy link
Contributor

bradfitz commented Feb 9, 2023

I've updated the package docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants