mirror of https://github.com/golang/go.git
cmd/go: unexport loadImport
Complete a TODO. Change-Id: I994311556f48ca3802e064e557ee96db6f0fdc85
This commit is contained in:
parent
1b8117b34a
commit
38a8d9df92
|
|
@ -655,20 +655,6 @@ const (
|
|||
cmdlinePkgLiteral
|
||||
)
|
||||
|
||||
// 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".
|
||||
// TODO(rsc): When GOPATH-based "go get" is removed, unexport this function.
|
||||
// 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, path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) (*Package, *PackageError) {
|
||||
return loadImport(ctx, opts, nil, path, srcDir, parent, stk, importPos, mode)
|
||||
}
|
||||
|
||||
// LoadPackage does Load import, but without a parent package load contezt
|
||||
func LoadPackage(ctx context.Context, opts PackageOpts, path, srcDir string, stk *ImportStack, importPos []token.Position, mode int) *Package {
|
||||
p, err := loadImport(ctx, opts, nil, path, srcDir, nil, stk, importPos, mode)
|
||||
|
|
@ -1971,7 +1957,7 @@ func (p *Package) load(ctx context.Context, opts PackageOpts, path string, stk *
|
|||
if path == "C" {
|
||||
continue
|
||||
}
|
||||
p1, err := LoadImport(ctx, opts, path, p.Dir, p, stk, p.Internal.Build.ImportPos[path], ResolveImport)
|
||||
p1, err := loadImport(ctx, opts, nil, path, p.Dir, p, stk, p.Internal.Build.ImportPos[path], ResolveImport)
|
||||
if err != nil && p.Error == nil {
|
||||
p.Error = err
|
||||
p.Incomplete = true
|
||||
|
|
@ -2696,7 +2682,7 @@ func TestPackageList(ctx context.Context, opts PackageOpts, roots []*Package) []
|
|||
}
|
||||
walkTest := func(root *Package, path string) {
|
||||
var stk ImportStack
|
||||
p1, err := LoadImport(ctx, opts, path, root.Dir, root, &stk, root.Internal.Build.TestImportPos[path], ResolveImport)
|
||||
p1, err := loadImport(ctx, opts, nil, path, root.Dir, root, &stk, root.Internal.Build.TestImportPos[path], ResolveImport)
|
||||
if err != nil && root.Error == nil {
|
||||
// Assign error importing the package to the importer.
|
||||
root.Error = err
|
||||
|
|
@ -2724,7 +2710,7 @@ func TestPackageList(ctx context.Context, opts PackageOpts, roots []*Package) []
|
|||
// TODO(jayconrod): delete this function and set flags automatically
|
||||
// in LoadImport instead.
|
||||
func LoadImportWithFlags(path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) (*Package, *PackageError) {
|
||||
p, err := LoadImport(context.TODO(), PackageOpts{}, path, srcDir, parent, stk, importPos, mode)
|
||||
p, err := loadImport(context.TODO(), PackageOpts{}, nil, path, srcDir, parent, stk, importPos, mode)
|
||||
setToolFlags(p)
|
||||
return p, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue