-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/cmd/bundle: make import resolution easier #57088
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
Comments
At a quick glance, it seems like it shouldn't be hard to scan the set of imports and package-level names, compute their intersection, and rename the necessary subset of imports to avoid the conflicts. Are you comfortable sending a CL to fix it? I'd be happy to review and approve it. |
Great!
Non-googlers must go through the CLA (copyright) process, but it's very quick. Other than that, it doesn't change anything.
No, you just need to add a numeric suffix to each conflicting import. I think you need to detect when an import name is a member of scope.Names() by calling scope.Lookup, and then adjust the import name by adding a numeric suffix and record a map entry from imported *types.PkgName to new name. Then fix up all references to the PkgName by adding an extra case here |
I think this is a bug fix. I don't see any reason why it has to go through the proposal process, so taking it out. |
Looks like this could be (partially) related to #37689. |
Its hard to resolve import conflicts with https://pkg.go.dev/golang.org/x/tools/cmd/bundle.
https://cs.opensource.google/go/x/tools/+/refs/tags/v0.3.0:cmd/bundle/main.go;l=256
@adonovan @shurcooL
If the "shadow" thing can't be solved, maybe you can do any of the following?
-import old=""
-import old="alias import"
The text was updated successfully, but these errors were encountered: