Skip to content

Commit 00c0055

Browse files
author
Bryan C. Mills
committed
cmd/go/internal/modload: remove unused functions
Also unexport functions that are not used outside the modload package. Change-Id: I0de187cbb673cadafce95a27f5ccff934ae21104 Reviewed-on: https://go-review.googlesource.com/c/go/+/332570 Trust: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
1 parent f264879 commit 00c0055

File tree

2 files changed

+2
-39
lines changed

2 files changed

+2
-39
lines changed

src/cmd/go/internal/modload/load.go

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -675,20 +675,6 @@ func DirImportPath(ctx context.Context, dir string) string {
675675
return "."
676676
}
677677

678-
// TargetPackages returns the list of packages in the target (top-level) module
679-
// matching pattern, which may be relative to the working directory, under all
680-
// build tag settings.
681-
func TargetPackages(ctx context.Context, pattern string) *search.Match {
682-
// TargetPackages is relative to the main module, so ensure that the main
683-
// module is a thing that can contain packages.
684-
LoadModFile(ctx) // Sets Target.
685-
ModRoot() // Emits an error if Target cannot contain packages.
686-
687-
m := search.NewMatch(pattern)
688-
matchPackages(ctx, m, imports.AnyTags(), omitStd, []module.Version{Target})
689-
return m
690-
}
691-
692678
// ImportMap returns the actual package import path
693679
// for an import path found in source code.
694680
// If the given import path does not appear in the source code
@@ -720,29 +706,6 @@ func PackageModule(path string) module.Version {
720706
return pkg.mod
721707
}
722708

723-
// PackageImports returns the imports for the package named by the import path.
724-
// Test imports will be returned as well if tests were loaded for the package
725-
// (i.e., if "all" was loaded or if LoadTests was set and the path was matched
726-
// by a command line argument). PackageImports will return nil for
727-
// unknown package paths.
728-
func PackageImports(path string) (imports, testImports []string) {
729-
pkg, ok := loaded.pkgCache.Get(path).(*loadPkg)
730-
if !ok {
731-
return nil, nil
732-
}
733-
imports = make([]string, len(pkg.imports))
734-
for i, p := range pkg.imports {
735-
imports[i] = p.path
736-
}
737-
if pkg.test != nil {
738-
testImports = make([]string, len(pkg.test.imports))
739-
for i, p := range pkg.test.imports {
740-
testImports[i] = p.path
741-
}
742-
}
743-
return imports, testImports
744-
}
745-
746709
// Lookup returns the source directory, import path, and any loading error for
747710
// the package at path as imported from the package in parentDir.
748711
// Lookup requires that one of the Load functions in this package has already

src/cmd/go/internal/modload/query.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,8 +920,8 @@ func (e *PackageNotInModuleError) ImportPath() string {
920920
return ""
921921
}
922922

923-
// ModuleHasRootPackage returns whether module m contains a package m.Path.
924-
func ModuleHasRootPackage(ctx context.Context, m module.Version) (bool, error) {
923+
// moduleHasRootPackage returns whether module m contains a package m.Path.
924+
func moduleHasRootPackage(ctx context.Context, m module.Version) (bool, error) {
925925
needSum := false
926926
root, isLocal, err := fetch(ctx, m, needSum)
927927
if err != nil {

0 commit comments

Comments
 (0)