sdboyer / gps

your dependencies have arrived
MIT License
270 stars 24 forks source link

[Regression] vanity imports not reporting correct root #217

Closed sdboyer closed 7 years ago

sdboyer commented 7 years ago

golang/dep#387 discovered an issue where vanity imports would not operate on the correct root. For example, golang.org/x/net/html would report golang.org/x/net/html as the root instead of golang.org/x/net.

sdboyer commented 7 years ago

Turns out this was a caching problem - the initial deduction was correct, but I was thinking incorrectly about the different "root" values coming back from an httpMetadataDeducer, and thus was inserting the original requested import path into the trie/cache.

Consequently, the first result reported was correct (which is why existing gps' tests didn't catch the problem), but subsequent cached results would be incorrect, as described in the other issue.

The fix removes the overzealous insert. It also changes all the deduction tests to always run twice, so that we test both the cached and uncached paths.