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

cmd/go: do not lookup "parent" modules automatically to resolve imports #33568

Open
rsc opened this issue Aug 9, 2019 · 4 comments

Comments

@rsc
Copy link
Contributor

commented Aug 9, 2019

One of the most annoying missteps the go command makes is when you mistype an import path in your own module and it goes looking for parent modules that might provide the import. In general that's fine, but I think automatic download and search of parents of the main module should be disabled - it's almost always a typo, and if not the user can run go get explicitly.

For example if I am in module rsc.io/tmp/x and import rsc.io/tmp/x/foo instead of rsc.io/tmp/x/boo, it should not try to download rsc.io/tmp and rsc.io to find rsc.io/tmp/x/foo.

/cc @bcmills @jayconrod

@rsc rsc added this to the Go1.14 milestone Aug 9, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented Aug 9, 2019

Nested modules in general are rare enough that I would be fine with a special-case to avoid this lookup.

@mvdan

This comment has been minimized.

Copy link
Member

commented Aug 9, 2019

I seem to remember a recent issue from @myitcv, where he reported that the go tool was incorrectly trying to find a myitcv.io module.

@bcmills

This comment has been minimized.

Copy link
Member

commented Aug 9, 2019

On the other hand, if we get rid of the finding chatter (#26152), is it actually that harmful to search for other modules? Those lookups should complete quickly anyway.

@myitcv

This comment has been minimized.

Copy link
Member

commented Aug 12, 2019

@mvdan the example I had was actually with github.com in #33351

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.