Skip to content

x/tools/go/packages: document that different package loads lead to different type identities #61418

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
griesemer opened this issue Jul 18, 2023 · 2 comments
Assignees
Labels
Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@griesemer
Copy link
Contributor

griesemer commented Jul 18, 2023

When loading the same set of packages twice, user-defined types are not guaranteed to have the same type identity.
This should be explicitly documented.

See #61412 for an example where not understanding this property causes problems.

cc: @findleyr @alandonovan

@griesemer griesemer added Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done. labels Jul 18, 2023
@griesemer griesemer added this to the Backlog milestone Jul 18, 2023
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Jul 18, 2023
@adonovan
Copy link
Member

adonovan commented Jul 18, 2023

Yes, we should document that. But see also #57497, which argues that we might be able to finesse the issue (at least for package-level types) by allowing two distinct Named to be identical if their (PkgPath, Name) pairs are equal.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/588141 mentions this issue: go/packages: document fields that are part of JSON schema

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants