Skip to content

Commit

Permalink
Fix: references to packages ignored by filterF were not created
Browse files Browse the repository at this point in the history
  • Loading branch information
korfuri committed Jul 12, 2017
1 parent 6bb8ccf commit 86d6865
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packagegraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (pg *PackageGraph) loadPackage(prog *loader.Program, loadpath string, pi *l
if specialPkg := specialPackage(loadpath); specialPkg != nil {
pkg = specialPkg
}

// If we didn't find a hardcoded package, rely on versionF to
// tell us what version this package should have. Otherwise
// use the hardcoded Package's Version.
Expand All @@ -147,13 +148,6 @@ func (pg *PackageGraph) loadPackage(prog *loader.Program, loadpath string, pi *l
version = pkg.Version
}

// Apply filterF to stop loading any package that doesn't pass
// the filter. Note that if a package was already present in
// the graph, filterF is not called.
if !pg.filterF(loadpath, version) {
return nil
}

// Find what corpus this package was loaded from.
var corpus Corpus
if len(pi.Files) > 0 {
Expand All @@ -174,6 +168,13 @@ func (pg *PackageGraph) loadPackage(prog *loader.Program, loadpath string, pi *l
pkg = newPackage(pi, prog.Fset, version, corpus)
pg.Packages[loadpath] = pkg

// Apply filterF to stop loading any package that doesn't pass
// the filter. Note that if a package was already present in
// the graph, filterF is not called.
if !pg.filterF(loadpath, version) {
return pkg
}

// Iterate over all files in that package.
for _, f := range pi.Files {
// Iterate over all imports in that file
Expand Down

0 comments on commit 86d6865

Please sign in to comment.