Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
gps: Don't drop visible packages with errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sdboyer committed Oct 14, 2017
1 parent 09ee5b7 commit 0951d5d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/gps/pkgtree/pkgtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,10 @@ func (t PackageTree) Copy() PackageTree {
// a set of tree-external imports; calling ToReachMap and FlattenFn will achieve
// the same effect.
func (t PackageTree) TrimHiddenPackages(main, tests, keepIgnored bool, ignore *IgnoredRuleset) PackageTree {
rm, _ := t.ToReachMap(main, tests, false, ignore)
rm, pie := t.ToReachMap(main, tests, false, ignore)
t2 := t.Copy()
preserve := make(map[string]bool)

for pkg, ie := range rm {
if pkgFilter(pkg) && (keepIgnored || !ignore.IsIgnored(pkg)) {
preserve[pkg] = true
Expand All @@ -671,6 +672,14 @@ func (t PackageTree) TrimHiddenPackages(main, tests, keepIgnored bool, ignore *I
}
}

// Also process the problem map, as packages in the visible set with errors
// need to be included in the return values.
for pkg := range pie {
if pkgFilter(pkg) && (keepIgnored || !ignore.IsIgnored(pkg)) {
preserve[pkg] = true
}
}

for ip := range t.Packages {
if !preserve[ip] {
delete(t2.Packages, ip)
Expand Down

0 comments on commit 0951d5d

Please sign in to comment.