mirror of https://github.com/golang/go.git
internal/imports: actually skip things in scan
An important part of letting the callback choose what to load is...not loading the stuff it doesn't want. Change-Id: I4048d7aed756b6ebc26fb6f8e384f44c64281f90 Reviewed-on: https://go-review.googlesource.com/c/tools/+/213129 Run-TryBot: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
6de373a276
commit
7bda30096d
|
|
@ -1175,18 +1175,20 @@ func (r *gopathResolver) scan(ctx context.Context, callback *scanCallback) error
|
|||
p.relevance = MaxRelevance
|
||||
}
|
||||
|
||||
if callback.dirFound(p) {
|
||||
var err error
|
||||
p.packageName, err = r.cache.CachePackageName(info)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if !callback.dirFound(p) {
|
||||
continue
|
||||
}
|
||||
var err error
|
||||
p.packageName, err = r.cache.CachePackageName(info)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if callback.packageNameLoaded(p) {
|
||||
if _, exports, err := r.loadExports(ctx, p); err == nil {
|
||||
callback.exportsLoaded(p, exports)
|
||||
}
|
||||
if !callback.packageNameLoaded(p) {
|
||||
continue
|
||||
}
|
||||
if _, exports, err := r.loadExports(ctx, p); err == nil {
|
||||
callback.exportsLoaded(p, exports)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -378,27 +378,27 @@ func (r *ModuleResolver) scan(ctx context.Context, callback *scanCallback) error
|
|||
if scanned, err := info.reachedStatus(directoryScanned); !scanned || err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
pkg, err := r.canonicalize(info)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if callback.dirFound(pkg) {
|
||||
var err error
|
||||
pkg.packageName, err = r.cachePackageName(info)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !callback.dirFound(pkg) {
|
||||
return
|
||||
}
|
||||
pkg.packageName, err = r.cachePackageName(info)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if callback.packageNameLoaded(pkg) {
|
||||
_, exports, err := r.loadExports(ctx, pkg)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
callback.exportsLoaded(pkg, exports)
|
||||
if !callback.packageNameLoaded(pkg) {
|
||||
return
|
||||
}
|
||||
_, exports, err := r.loadExports(ctx, pkg)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
callback.exportsLoaded(pkg, exports)
|
||||
}
|
||||
|
||||
// Everything we already had is in the cache. Process it now, in hopes we
|
||||
|
|
|
|||
Loading…
Reference in New Issue