aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/load.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2021-07-02 13:15:37 -0400
committerGopher Robot <gobot@golang.org>2022-08-23 18:22:17 +0000
commitbe9e2440a766f4cd1069945ebd2e527cb7fd7594 (patch)
treeb65bbac9aa12d5b86933b50c0880ff9caa38ae9e /src/cmd/go/internal/modload/load.go
parentde561dc7664c9792964d8fa74a3aa02263ee36b9 (diff)
downloadgo-be9e2440a766f4cd1069945ebd2e527cb7fd7594.tar.gz
go-be9e2440a766f4cd1069945ebd2e527cb7fd7594.zip
cmd/go/internal/modload: remove ImportMap and PackageDir
These two functions together duplicated much of the functionality of modload.Lookup. Use that instead in modcmd.vendorPkg, and reduce the modload surface area. Updates #42504 Updates #40775 For #26904 Change-Id: Ib8aaac495d090178dd56971aef9e5aa44ffa818b Reviewed-on: https://go-review.googlesource.com/c/go/+/332571 Reviewed-by: Michael Matloob <matloob@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/load.go')
-rw-r--r--src/cmd/go/internal/modload/load.go22
1 files changed, 0 insertions, 22 deletions
diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go
index a36ac9c5bb..7e061f01a4 100644
--- a/src/cmd/go/internal/modload/load.go
+++ b/src/cmd/go/internal/modload/load.go
@@ -767,28 +767,6 @@ func (mms *MainModuleSet) DirImportPath(ctx context.Context, dir string) (path s
return ".", module.Version{}
}
-// ImportMap returns the actual package import path
-// for an import path found in source code.
-// If the given import path does not appear in the source code
-// for the packages that have been loaded, ImportMap returns the empty string.
-func ImportMap(path string) string {
- pkg, ok := loaded.pkgCache.Get(path).(*loadPkg)
- if !ok {
- return ""
- }
- return pkg.path
-}
-
-// PackageDir returns the directory containing the source code
-// for the package named by the import path.
-func PackageDir(path string) string {
- pkg, ok := loaded.pkgCache.Get(path).(*loadPkg)
- if !ok {
- return ""
- }
- return pkg.dir
-}
-
// PackageModule returns the module providing the package named by the import path.
func PackageModule(path string) module.Version {
pkg, ok := loaded.pkgCache.Get(path).(*loadPkg)