From 7c9bc60f0060a5063f7ea078f294b17b1a4eb74a Mon Sep 17 00:00:00 2001 From: qiulaidongfeng <2645477756@qq.com> Date: Tue, 14 May 2024 06:22:05 +0800 Subject: [PATCH] n Change-Id: Ieb99e1840430349c9a1be75b65bff8cb0be67fd1 --- src/cmd/go/internal/load/pkg.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go index 170b4aa15d..6ce1afcfb2 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go @@ -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()