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

go/internal/srcimporter: src importer cannot handle re-import #19337

Open
griesemer opened this issue Mar 1, 2017 · 1 comment
Open

go/internal/srcimporter: src importer cannot handle re-import #19337

griesemer opened this issue Mar 1, 2017 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@griesemer
Copy link
Contributor

The existing importers go out of their way to augment partially imported packages (types, etc.).

A source importer doesn't do that - it uses go/types to always create a new package. If only the source importer is used, then (recursively), any package that is imported somewhere is imported as a whole, so all packages are complete upon import and there's never a need to augment a package.

If we want to provide a "mixed-mode" importer, where some packages are imported from installed packages, and some from source, depending on which is newer, the above is not so simple anymore: A package may be imported from an installed location, which in turn may contain partial package information about another package.

If that other package is imported from source, it must augment the partial package in the packages map rather than replace it.

This matters only for types since they are the only objects that may be used in the construction of other package-level objects - they must be unique.

One could expand the go/types API and provide a partially complete package that is then expanded. Or one could do a "full" import and then somehow merge the new with the old package (and update any types that need to be canonicalized - a tricky proposition).

Or one could disallow "mixed-mode" imports (currently they are not supported anyway).

Needs to be resolved before we can implement mixed-mode imports.

@griesemer griesemer added this to the Unplanned milestone Mar 1, 2017
@griesemer griesemer self-assigned this Mar 1, 2017
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/37620 mentions this issue.

gopherbot pushed a commit that referenced this issue Mar 1, 2017
See the issue below for details.

For #19337.

Change-Id: I7637dcd4408f1bc4a9b3050a107aadb4de6f950b
Reviewed-on: https://go-review.googlesource.com/37620
Reviewed-by: Alan Donovan <adonovan@google.com>
DisposaBoy added a commit to DisposaBoy/margo that referenced this issue Aug 27, 2018
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants