Change-Id: Ieb99e1840430349c9a1be75b65bff8cb0be67fd1
This commit is contained in:
qiulaidongfeng 2024-05-14 06:22:05 +08:00
parent 38a8d9df92
commit 7c9bc60f00
1 changed files with 9 additions and 0 deletions

View File

@ -664,6 +664,15 @@ func LoadPackage(ctx context.Context, opts PackageOpts, path, srcDir string, stk
return p
}
// loadImport scans the directory named by path, which must be an import path,
// but possibly a local import path (an absolute file system path or one beginning
// with ./ or ../). A local relative path is interpreted relative to srcDir.
// It returns a *Package describing the package found in that directory.
// loadImport does not set tool flags and should only be used by
// this package, as part of a bigger load operation, and by GOPATH-based "go get".
// The returned PackageError, if any, describes why parent is not allowed
// to import the named package, with the error referring to importPos.
// The PackageError can only be non-nil when parent is not nil.
func loadImport(ctx context.Context, opts PackageOpts, pre *preload, path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) (*Package, *PackageError) {
ctx, span := trace.StartSpan(ctx, "modload.loadImport "+path)
defer span.Done()