diff --git a/src/cmd/go/internal/modload/build.go b/src/cmd/go/internal/modload/build.go index b9e344045d2..8ad5f834def 100644 --- a/src/cmd/go/internal/modload/build.go +++ b/src/cmd/go/internal/modload/build.go @@ -75,7 +75,7 @@ func ModuleInfo(ctx context.Context, path string) *modinfo.ModulePublic { return moduleInfo(ctx, m, fromBuildList, listRetracted) } - for _, m := range LoadedModules() { + for _, m := range buildList { if m.Path == path { fromBuildList := true return moduleInfo(ctx, m, fromBuildList, listRetracted) diff --git a/src/cmd/go/internal/modload/buildlist.go b/src/cmd/go/internal/modload/buildlist.go index 5b9984a4924..bec22dba1f6 100644 --- a/src/cmd/go/internal/modload/buildlist.go +++ b/src/cmd/go/internal/modload/buildlist.go @@ -49,15 +49,6 @@ func LoadAllModules(ctx context.Context) []module.Version { return capVersionSlice(buildList) } -// LoadedModules returns the list of module requirements loaded or set by a -// previous call (typically LoadAllModules or LoadPackages), starting with the -// Target module and in a deterministic (stable) order. -// -// The caller must not modify the returned list, but may append to it. -func LoadedModules() []module.Version { - return capVersionSlice(buildList) -} - // Selected returns the selected version of the module with the given path, or // the empty string if the given module has no selected version // (either because it is not required or because it is the Target module).