Open myitcv opened 5 years ago
@ianthehat
This would be fairly easy to do as a separate pass. I don't think it would make a huge performance difference for most people, but maybe if you have a gigantic module cache or are looking for a very generic package like "util" or something. For me, the stronger argument is just that we should be biased against adding new deps when an existing dep suffices.
Any progress on this? It's a constant thorn in my side when dealing with any dependency that's v2
or up.
I don't think it would make a huge performance difference for most people
It might actually be quite a bit faster, as I think that 99% of the time you're looking for a package that's in one of the dependencies in go.mod
.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Ran
testscript
on the following:What did you expect to see?
A passing run.
What did you see instead?
A failed run.
goimports
should be "consulting" the main module for matches before dropping down to a module cache-based search. Here that would have resulted ingopkg.in/tomb.v2
being correctly resolved, instead ofgopkg.in/tomb.v1
.This will, I suspect, also massively improve the speed of
goimports
in a large majority of cases.cc @heschik