mirror of
https://github.com/golang/go
synced 2024-11-23 21:30:08 -07:00
cmd/go/internal/load: remove unused argument from Lookup
Change-Id: Ia2948a88c6d45a31be17b3d7415559cd53c289ce Reviewed-on: https://go-review.googlesource.com/128015 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
79faf9246e
commit
9ef5ee911c
@ -33,7 +33,7 @@ var (
|
||||
|
||||
// module hooks; nil if module use is disabled
|
||||
ModBinDir func() string // return effective bin directory
|
||||
ModLookup func(parentPath, path string) (dir, realPath string, err error) // lookup effective meaning of import
|
||||
ModLookup func(path string) (dir, realPath string, err error) // lookup effective meaning of import
|
||||
ModPackageModuleInfo func(path string) *modinfo.ModulePublic // return module info for Package struct
|
||||
ModImportPaths func(args []string) []string // expand import paths
|
||||
ModPackageBuildInfo func(main string, deps []string) string // return module info to embed in binary
|
||||
@ -488,7 +488,7 @@ func LoadImport(path, srcDir string, parent *Package, stk *ImportStack, importPo
|
||||
importPath = dirToImportPath(filepath.Join(srcDir, path))
|
||||
} else if cfg.ModulesEnabled {
|
||||
var p string
|
||||
modDir, p, modErr = ModLookup(parentPath, path)
|
||||
modDir, p, modErr = ModLookup(path)
|
||||
if modErr == nil {
|
||||
importPath = p
|
||||
}
|
||||
@ -628,11 +628,7 @@ func isDir(path string) bool {
|
||||
// Go 1.11 module legacy conversion (golang.org/issue/25069).
|
||||
func ResolveImportPath(parent *Package, path string) (found string) {
|
||||
if cfg.ModulesEnabled {
|
||||
parentPath := ""
|
||||
if parent != nil {
|
||||
parentPath = parent.ImportPath
|
||||
}
|
||||
if _, p, e := ModLookup(parentPath, path); e == nil {
|
||||
if _, p, e := ModLookup(path); e == nil {
|
||||
return p
|
||||
}
|
||||
return path
|
||||
@ -1771,7 +1767,7 @@ func LoadPackage(arg string, stk *ImportStack) *Package {
|
||||
return LoadImport(arg, base.Cwd, nil, stk, nil, 0)
|
||||
}
|
||||
|
||||
// packages returns the packages named by the
|
||||
// Packages returns the packages named by the
|
||||
// command line arguments 'args'. If a named package
|
||||
// cannot be loaded at all (for example, if the directory does not exist),
|
||||
// then packages prints an error and does not include that
|
||||
@ -1791,7 +1787,7 @@ func Packages(args []string) []*Package {
|
||||
return pkgs
|
||||
}
|
||||
|
||||
// packagesAndErrors is like 'packages' but returns a
|
||||
// PackagesAndErrors is like 'packages' but returns a
|
||||
// *Package for every argument, even the ones that
|
||||
// cannot be loaded at all.
|
||||
// The packages that fail to load will have p.Error != nil.
|
||||
|
@ -337,8 +337,10 @@ func ModuleUsedDirectly(path string) bool {
|
||||
return loaded.direct[path]
|
||||
}
|
||||
|
||||
// Lookup XXX TODO.
|
||||
func Lookup(parentPath, path string) (dir, realPath string, err error) {
|
||||
// Lookup returns the source directory and import path for the package at path.
|
||||
// Lookup requires that one of the Load functions in this package has already
|
||||
// been called.
|
||||
func Lookup(path string) (dir, realPath string, err error) {
|
||||
realPath = ImportMap(path)
|
||||
if realPath == "" {
|
||||
if isStandardImportPath(path) {
|
||||
|
Loading…
Reference in New Issue
Block a user