go/packages: remove code that handled ordering in overlays

Now that overlays are sorted before being processed, we can assume a
consistent ordering of non-test files before test files. Some of the
code in the overlay processing therefore becomes unneeded.

Change-Id: Ic7a20ceb7013af7ce876a280c975eadf717157d7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/216722
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
Rebecca Stambler 2020-01-28 18:17:02 -05:00
parent e1fd5825ff
commit cf670267be
1 changed files with 1 additions and 8 deletions

View File

@ -50,7 +50,6 @@ func (state *golistState) processGolistOverlay(response *responseDeduper) (modif
}
return overlayFiles[i] < overlayFiles[j]
})
for _, opath := range overlayFiles {
contents := state.cfg.Overlay[opath]
base := filepath.Base(opath)
@ -82,14 +81,8 @@ func (state *golistState) processGolistOverlay(response *responseDeduper) (modif
testVariantOf = p
continue nextPackage
}
// We must have already seen the package of which this is a test variant.
if pkg != nil && p != pkg && pkg.PkgPath == p.PkgPath {
// If we've already seen the test variant,
// make sure to label which package it is a test variant of.
if hasTestFiles(pkg) {
testVariantOf = p
continue nextPackage
}
// If we have already seen the package of which this is a test variant.
if hasTestFiles(p) {
testVariantOf = pkg
}