Hacker News new | ask | show | jobs
by rkharsan64 679 days ago
From the release notes [1], which I think this post should actually point to:

> For backward compatibility, existing usages of //go:linkname found in a large open-source code corpus remain supported. Any new references to standard library internal symbols will be disallowed.

How does this work? Does the compiler have a whitelist of allowed uses?

[1]: https://go.dev/doc/go1.23

1 comments

The source has to be annotated to export the function.
Just confirming if I understand this correctly: they went through a big chunk of existing code, and then made any internal symbols used in that corpus accessible via //go:linkname?

I don't know why, but I (stupidly) assumed that they wouldn't allow new code to be written that uses those symbols, while allowing old code to work. :)

This explanation makes a lot more sense. So, you can keep using the symbols exposed with this change (until a future release hides/changes them), but cannot use any other internal symbol(s) anymore.

Yes.