Skip to content

encoding/json/v2: investigate replacing jsontext.Internal symbol #73435

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

Open
neild opened this issue Apr 18, 2025 · 1 comment
Open

encoding/json/v2: investigate replacing jsontext.Internal symbol #73435

neild opened this issue Apr 18, 2025 · 1 comment
Labels
LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool Proposal

Comments

@neild
Copy link
Contributor

neild commented Apr 18, 2025

The draft encoding/json/jsontext package includes an "Internal" symbol used to expose internal implementation details to encoding/json and encoding/json/v2.

This is awkward and not something we've done in the public API of a package in the standard library before. We should avoid it if we can, even if that means some additional inconvenience for ourselves. Possibilities might include an additional internal package and/or //go:linkname shenanigans.

@gabyhelp gabyhelp added the LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool label Apr 18, 2025
@dsnet
Copy link
Member

dsnet commented Apr 18, 2025

One option is to move most of the logic in jsontext to an internal jsontext package and forward the public API via type aliases in the public jsontext package. This technique would work, but would result in a poor user experience. In particular, none of the methods nor any of the struct fields will be reflected on the godoc for the public jsontext package. Perhaps there should be a way to indicate on a type alias that we intend for the documentation to be forwarded? (Perhaps a combination of the fact that it references an internal package and lacks any doc comments?)

\cc @jba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool Proposal
Projects
None yet
Development

No branches or pull requests

4 participants