1
0
mirror of https://github.com/golang/go synced 2024-11-26 08:48:13 -07:00

cmd/go/internal/modload: eliminate LoadedModules

As of CL 271646, all external callers have been eliminated. Replace
the remaining internal caller with a direct reference to the buildList
variable and remove the exported function to prevent backsliding.

For #36460

Change-Id: Iea82df1e3e604ada602dda3e830c06d441eee2a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/271647
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Bryan C. Mills 2020-11-19 13:58:52 -05:00
parent 8bbd8294d0
commit cb3f84ad25
2 changed files with 1 additions and 10 deletions

View File

@ -75,7 +75,7 @@ func ModuleInfo(ctx context.Context, path string) *modinfo.ModulePublic {
return moduleInfo(ctx, m, fromBuildList, listRetracted) return moduleInfo(ctx, m, fromBuildList, listRetracted)
} }
for _, m := range LoadedModules() { for _, m := range buildList {
if m.Path == path { if m.Path == path {
fromBuildList := true fromBuildList := true
return moduleInfo(ctx, m, fromBuildList, listRetracted) return moduleInfo(ctx, m, fromBuildList, listRetracted)

View File

@ -49,15 +49,6 @@ func LoadAllModules(ctx context.Context) []module.Version {
return capVersionSlice(buildList) 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 // Selected returns the selected version of the module with the given path, or
// the empty string if the given module has no selected version // the empty string if the given module has no selected version
// (either because it is not required or because it is the Target module). // (either because it is not required or because it is the Target module).