diff options
| author | Ian Alexander <jitsu@google.com> | 2026-04-07 09:48:12 -0400 |
|---|---|---|
| committer | Ian Alexander <jitsu@google.com> | 2026-04-07 10:22:01 -0700 |
| commit | f48684c59cf9dce53468e4ae610d5e90739602b5 (patch) | |
| tree | 1717c493adcc220c95aac24357416300097a057a | |
| parent | 83d0189f8453841abef37b3262713c7f15ac2274 (diff) | |
| download | go-f48684c59cf9dce53468e4ae610d5e90739602b5.tar.xz | |
cmd/go/internal/modload: disambiguate package and module loaders
Change the short name of the packageLoader variables to `pld` to allow
for the module loader to use `ld` consistently.
This change is part of the effort to rename the modload.State type to
modload.Loader in order to better reflect its purpose.
Change-Id: I73b072613190bcca841bcca16e9af6e60ecd99f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/763380
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
| -rw-r--r-- | src/cmd/go/internal/modload/build.go | 4 | ||||
| -rw-r--r-- | src/cmd/go/internal/modload/init.go | 8 | ||||
| -rw-r--r-- | src/cmd/go/internal/modload/load.go | 346 |
3 files changed, 179 insertions, 179 deletions
diff --git a/src/cmd/go/internal/modload/build.go b/src/cmd/go/internal/modload/build.go index 2f1dca6f7b..e19becf5cc 100644 --- a/src/cmd/go/internal/modload/build.go +++ b/src/cmd/go/internal/modload/build.go @@ -449,8 +449,8 @@ func moduleInfo(loaderstate *State, ctx context.Context, rs *Requirements, m mod // findModule searches for the module that contains the package at path. // If the package was loaded, its containing module and true are returned. // Otherwise, module.Version{} and false are returned. -func findModule(ld *packageLoader, path string) (module.Version, bool) { - if pkg, ok := ld.pkgCache.Get(path); ok { +func findModule(pld *packageLoader, path string) (module.Version, bool) { + if pkg, ok := pld.pkgCache.Get(path); ok { return pkg.mod, pkg.mod != module.Version{} } return module.Version{}, false diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go index 13541f9350..65daa8a26c 100644 --- a/src/cmd/go/internal/modload/init.go +++ b/src/cmd/go/internal/modload/init.go @@ -2078,7 +2078,7 @@ func commitRequirements(loaderstate *State, ctx context.Context, opts WriteOpts) // including any go.mod files needed to reconstruct the MVS result // or identify go versions, // in addition to the checksums for every module in keepMods. -func keepSums(loaderstate *State, ctx context.Context, ld *packageLoader, rs *Requirements, which whichSums) map[module.Version]bool { +func keepSums(loaderstate *State, ctx context.Context, pld *packageLoader, rs *Requirements, which whichSums) map[module.Version]bool { // Every module in the full module graph contributes its requirements, // so in order to ensure that the build list itself is reproducible, // we need sums for every go.mod in the graph (regardless of whether @@ -2090,17 +2090,17 @@ func keepSums(loaderstate *State, ctx context.Context, ld *packageLoader, rs *Re // not just the modules containing the actual packages — in order to rule out // ambiguous import errors the next time we load the package. keepModSumsForZipSums := true - if ld == nil { + if pld == nil { if gover.Compare(loaderstate.MainModules.GoVersion(loaderstate), gover.TidyGoModSumVersion) < 0 && cfg.BuildMod != "mod" { keepModSumsForZipSums = false } } else { keepPkgGoModSums := true - if gover.Compare(ld.requirements.GoVersion(loaderstate), gover.TidyGoModSumVersion) < 0 && (ld.Tidy || cfg.BuildMod != "mod") { + if gover.Compare(pld.requirements.GoVersion(loaderstate), gover.TidyGoModSumVersion) < 0 && (pld.Tidy || cfg.BuildMod != "mod") { keepPkgGoModSums = false keepModSumsForZipSums = false } - for _, pkg := range ld.pkgs { + for _, pkg := range pld.pkgs { // We check pkg.mod.Path here instead of pkg.inStd because the // pseudo-package "C" is not in std, but not provided by any module (and // shouldn't force loading the whole module graph). diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go index f5266149d6..d5737565d5 100644 --- a/src/cmd/go/internal/modload/load.go +++ b/src/cmd/go/internal/modload/load.go @@ -257,7 +257,7 @@ func LoadPackages(loaderstate *State, ctx context.Context, opts PackageOpts, pat } } - updateMatches := func(rs *Requirements, ld *packageLoader) { + updateMatches := func(rs *Requirements, pld *packageLoader) { for _, m := range matches { switch { case m.IsLocal(): @@ -290,7 +290,7 @@ func LoadPackages(loaderstate *State, ctx context.Context, opts PackageOpts, pat die(loaderstate) } - if ld != nil { + if pld != nil { m.AddError(err) } continue @@ -323,7 +323,7 @@ func LoadPackages(loaderstate *State, ctx context.Context, opts PackageOpts, pat matchPackages(loaderstate, ctx, m, opts.Tags, omitStd, matchModules) case m.Pattern() == "all": - if ld == nil { + if pld == nil { // The initial roots are the packages and tools in the main module. // loadFromRoots will expand that to "all". m.Errs = m.Errs[:0] @@ -338,7 +338,7 @@ func LoadPackages(loaderstate *State, ctx context.Context, opts PackageOpts, pat } else { // Starting with the packages in the main module, // enumerate the full list of "all". - m.Pkgs = ld.computePatternAll() + m.Pkgs = pld.computePatternAll() } case m.Pattern() == "std" || m.Pattern() == "cmd": @@ -908,52 +908,52 @@ type loaderParams struct { listRoots func(rs *Requirements) []string } -func (ld *packageLoader) reset() { +func (pld *packageLoader) reset() { select { - case <-ld.work.Idle(): + case <-pld.work.Idle(): default: panic("loader.reset when not idle") } - ld.roots = nil - ld.pkgCache = new(par.Cache[string, *loadPkg]) - ld.pkgs = nil + pld.roots = nil + pld.pkgCache = new(par.Cache[string, *loadPkg]) + pld.pkgs = nil } // error reports an error via either os.Stderr or base.Error, // according to whether ld.AllowErrors is set. -func (ld *packageLoader) error(err error) { - if ld.AllowErrors { +func (pld *packageLoader) error(err error) { + if pld.AllowErrors { fmt.Fprintf(os.Stderr, "go: %v\n", err) - } else if ld.Switcher != nil { - ld.Switcher.Error(err) + } else if pld.Switcher != nil { + pld.Switcher.Error(err) } else { base.Error(err) } } // switchIfErrors switches toolchains if a switch is needed. -func (ld *packageLoader) switchIfErrors(ctx context.Context) { - if ld.Switcher != nil { - ld.Switcher.Switch(ctx) +func (pld *packageLoader) switchIfErrors(ctx context.Context) { + if pld.Switcher != nil { + pld.Switcher.Switch(ctx) } } // exitIfErrors switches toolchains if a switch is needed // or else exits if any errors have been reported. -func (ld *packageLoader) exitIfErrors(ctx context.Context) { - ld.switchIfErrors(ctx) +func (pld *packageLoader) exitIfErrors(ctx context.Context) { + pld.switchIfErrors(ctx) base.ExitIfErrors() } // goVersion reports the Go version that should be used for the loader's // requirements: ld.TidyGoVersion if set, or ld.requirements.GoVersion() // otherwise. -func (ld *packageLoader) goVersion(loaderstate *State) string { - if ld.TidyGoVersion != "" { - return ld.TidyGoVersion +func (pld *packageLoader) goVersion(loaderstate *State) string { + if pld.TidyGoVersion != "" { + return pld.TidyGoVersion } - return ld.requirements.GoVersion(loaderstate) + return pld.requirements.GoVersion(loaderstate) } // A loadPkg records information about a single loaded package. @@ -1072,12 +1072,12 @@ var errMissing = errors.New("cannot find package") // expanded to the full set of packages by tracing imports (and possibly tests) // as needed. func loadFromRoots(loaderstate *State, ctx context.Context, params loaderParams) *packageLoader { - ld := &packageLoader{ + pld := &packageLoader{ loaderParams: params, work: par.NewQueue(runtime.GOMAXPROCS(0)), } - if ld.requirements.pruning == unpruned { + if pld.requirements.pruning == unpruned { // If the module graph does not support pruning, we assume that we will need // the full module graph in order to load package dependencies. // @@ -1087,53 +1087,53 @@ func loadFromRoots(loaderstate *State, ctx context.Context, params loaderParams) // spot-checks in modules that do not maintain the expanded go.mod // requirements needed for graph pruning. var err error - ld.requirements, _, err = expandGraph(loaderstate, ctx, ld.requirements) + pld.requirements, _, err = expandGraph(loaderstate, ctx, pld.requirements) if err != nil { - ld.error(err) + pld.error(err) } } - ld.exitIfErrors(ctx) + pld.exitIfErrors(ctx) updateGoVersion := func() { - goVersion := ld.goVersion(loaderstate) + goVersion := pld.goVersion(loaderstate) - if ld.requirements.pruning != workspace { + if pld.requirements.pruning != workspace { var err error - ld.requirements, err = convertPruning(loaderstate, ctx, ld.requirements, pruningForGoVersion(goVersion)) + pld.requirements, err = convertPruning(loaderstate, ctx, pld.requirements, pruningForGoVersion(goVersion)) if err != nil { - ld.error(err) - ld.exitIfErrors(ctx) + pld.error(err) + pld.exitIfErrors(ctx) } } // If the module's Go version omits go.sum entries for go.mod files for test // dependencies of external packages, avoid loading those files in the first // place. - ld.skipImportModFiles = ld.Tidy && gover.Compare(goVersion, gover.TidyGoModSumVersion) < 0 + pld.skipImportModFiles = pld.Tidy && gover.Compare(goVersion, gover.TidyGoModSumVersion) < 0 // If the module's go version explicitly predates the change in "all" for // graph pruning, continue to use the older interpretation. - ld.allClosesOverTests = gover.Compare(goVersion, gover.NarrowAllVersion) < 0 && !ld.UseVendorAll + pld.allClosesOverTests = gover.Compare(goVersion, gover.NarrowAllVersion) < 0 && !pld.UseVendorAll } for { - ld.reset() + pld.reset() updateGoVersion() // Load the root packages and their imports. // Note: the returned roots can change on each iteration, // since the expansion of package patterns depends on the // build list we're using. - rootPkgs := ld.listRoots(ld.requirements) + rootPkgs := pld.listRoots(pld.requirements) - if ld.requirements.pruning == pruned && cfg.BuildMod == "mod" { + if pld.requirements.pruning == pruned && cfg.BuildMod == "mod" { // Before we start loading transitive imports of packages, locate all of // the root packages and promote their containing modules to root modules // dependencies. If their go.mod files are tidy (the common case) and the // set of root packages does not change then we can select the correct // versions of all transitive imports on the first try and complete // loading in a single iteration. - changedBuildList := ld.preloadRootModules(loaderstate, ctx, rootPkgs) + changedBuildList := pld.preloadRootModules(loaderstate, ctx, rootPkgs) if changedBuildList { // The build list has changed, so the set of root packages may have also // changed. Start over to pick up the changes. (Preloading roots is much @@ -1146,9 +1146,9 @@ func loadFromRoots(loaderstate *State, ctx context.Context, params loaderParams) inRoots := map[*loadPkg]bool{} for _, path := range rootPkgs { - root := ld.pkg(loaderstate, ctx, path, pkgIsRoot) + root := pld.pkg(loaderstate, ctx, path, pkgIsRoot) if !inRoots[root] { - ld.roots = append(ld.roots, root) + pld.roots = append(pld.roots, root) inRoots[root] = true } } @@ -1158,13 +1158,13 @@ func loadFromRoots(loaderstate *State, ctx context.Context, params loaderParams) // // When all of the work in the queue has completed, we'll know that the // transitive closure of dependencies has been loaded. - <-ld.work.Idle() + <-pld.work.Idle() - ld.buildStacks() + pld.buildStacks() - changed, err := ld.updateRequirements(loaderstate, ctx) + changed, err := pld.updateRequirements(loaderstate, ctx) if err != nil { - ld.error(err) + pld.error(err) break } if changed { @@ -1176,14 +1176,14 @@ func loadFromRoots(loaderstate *State, ctx context.Context, params loaderParams) continue } - if !ld.ResolveMissingImports || (!loaderstate.HasModRoot() && !loaderstate.allowMissingModuleImports) { + if !pld.ResolveMissingImports || (!loaderstate.HasModRoot() && !loaderstate.allowMissingModuleImports) { // We've loaded as much as we can without resolving missing imports. break } - modAddedBy, err := ld.resolveMissingImports(loaderstate, ctx) + modAddedBy, err := pld.resolveMissingImports(loaderstate, ctx) if err != nil { - ld.error(err) + pld.error(err) break } if len(modAddedBy) == 0 { @@ -1207,66 +1207,66 @@ func loadFromRoots(loaderstate *State, ctx context.Context, params loaderParams) // We also know that we're going to call updateRequirements again next // iteration so we don't need to also update it here. (That would waste time // computing a "direct" map that we'll have to recompute later anyway.) - direct := ld.requirements.direct - rs, err := updateRoots(loaderstate, ctx, direct, ld.requirements, noPkgs, toAdd, ld.AssumeRootsImported) + direct := pld.requirements.direct + rs, err := updateRoots(loaderstate, ctx, direct, pld.requirements, noPkgs, toAdd, pld.AssumeRootsImported) if err != nil { // If an error was found in a newly added module, report the package // import stack instead of the module requirement stack. Packages // are more descriptive. if err, ok := err.(*mvs.BuildListError); ok { if pkg := modAddedBy[err.Module()]; pkg != nil { - ld.error(fmt.Errorf("%s: %w", pkg.stackText(), err.Err)) + pld.error(fmt.Errorf("%s: %w", pkg.stackText(), err.Err)) break } } - ld.error(err) + pld.error(err) break } - if slices.Equal(rs.rootModules, ld.requirements.rootModules) { + if slices.Equal(rs.rootModules, pld.requirements.rootModules) { // Something is deeply wrong. resolveMissingImports gave us a non-empty // set of modules to add to the graph, but adding those modules had no // effect — either they were already in the graph, or updateRoots did not // add them as requested. panic(fmt.Sprintf("internal error: adding %v to module graph had no effect on root requirements (%v)", toAdd, rs.rootModules)) } - ld.requirements = rs + pld.requirements = rs } - ld.exitIfErrors(ctx) + pld.exitIfErrors(ctx) // Tidy the build list, if applicable, before we report errors. // (The process of tidying may remove errors from irrelevant dependencies.) - if ld.Tidy { - rs, err := tidyRoots(loaderstate, ctx, ld.requirements, ld.pkgs) + if pld.Tidy { + rs, err := tidyRoots(loaderstate, ctx, pld.requirements, pld.pkgs) if err != nil { - ld.error(err) + pld.error(err) } else { - if ld.TidyGoVersion != "" { + if pld.TidyGoVersion != "" { // Attempt to switch to the requested Go version. We have been using its // pruning and semantics all along, but there may have been — and may // still be — requirements on higher versions in the graph. - tidy := overrideRoots(loaderstate, ctx, rs, []module.Version{{Path: "go", Version: ld.TidyGoVersion}}) + tidy := overrideRoots(loaderstate, ctx, rs, []module.Version{{Path: "go", Version: pld.TidyGoVersion}}) mg, err := tidy.Graph(loaderstate, ctx) if err != nil { - ld.error(err) + pld.error(err) } - if v := mg.Selected("go"); v == ld.TidyGoVersion { + if v := mg.Selected("go"); v == pld.TidyGoVersion { rs = tidy } else { conflict := Conflict{ Path: mg.g.FindPath(func(m module.Version) bool { return m.Path == "go" && m.Version == v })[1:], - Constraint: module.Version{Path: "go", Version: ld.TidyGoVersion}, + Constraint: module.Version{Path: "go", Version: pld.TidyGoVersion}, } msg := conflict.Summary() if cfg.BuildV { msg = conflict.String() } - ld.error(errors.New(msg)) + pld.error(errors.New(msg)) } } - if ld.requirements.pruning == pruned { + if pld.requirements.pruning == pruned { // We continuously add tidy roots to ld.requirements during loading, so // at this point the tidy roots (other than possibly the "go" version // edited above) should be a subset of the roots of ld.requirements, @@ -1274,23 +1274,23 @@ func loadFromRoots(loaderstate *State, ctx context.Context, params loaderParams) // graph-pruning horizon. // If that is not the case, there is a bug in the loading loop above. for _, m := range rs.rootModules { - if m.Path == "go" && ld.TidyGoVersion != "" { + if m.Path == "go" && pld.TidyGoVersion != "" { continue } - if v, ok := ld.requirements.rootSelected(loaderstate, m.Path); !ok || v != m.Version { - ld.error(fmt.Errorf("internal error: a requirement on %v is needed but was not added during package loading (selected %s)", m, v)) + if v, ok := pld.requirements.rootSelected(loaderstate, m.Path); !ok || v != m.Version { + pld.error(fmt.Errorf("internal error: a requirement on %v is needed but was not added during package loading (selected %s)", m, v)) } } } - ld.requirements = rs + pld.requirements = rs } - ld.exitIfErrors(ctx) + pld.exitIfErrors(ctx) } // Report errors, if any. - for _, pkg := range ld.pkgs { + for _, pkg := range pld.pkgs { if pkg.err == nil { continue } @@ -1312,22 +1312,22 @@ func loadFromRoots(loaderstate *State, ctx context.Context, params loaderParams) stdErr.importerGoVersion = v.(string) } } - if ld.SilenceMissingStdImports { + if pld.SilenceMissingStdImports { continue } } - if ld.SilencePackageErrors { + if pld.SilencePackageErrors { continue } - if ld.SilenceNoGoErrors && errors.Is(pkg.err, imports.ErrNoGo) { + if pld.SilenceNoGoErrors && errors.Is(pkg.err, imports.ErrNoGo) { continue } - ld.error(fmt.Errorf("%s: %w", pkg.stackText(), pkg.err)) + pld.error(fmt.Errorf("%s: %w", pkg.stackText(), pkg.err)) } - ld.checkMultiplePaths(loaderstate) - return ld + pld.checkMultiplePaths(loaderstate) + return pld } // updateRequirements ensures that ld.requirements is consistent with the @@ -1349,8 +1349,8 @@ func loadFromRoots(loaderstate *State, ctx context.Context, params loaderParams) // The "changed" return value reports whether the update changed the selected // version of any module that either provided a loaded package or may now // provide a package that was previously unresolved. -func (ld *packageLoader) updateRequirements(loaderstate *State, ctx context.Context) (changed bool, err error) { - rs := ld.requirements +func (pld *packageLoader) updateRequirements(loaderstate *State, ctx context.Context) (changed bool, err error) { + rs := pld.requirements // direct contains the set of modules believed to provide packages directly // imported by the main module. @@ -1360,7 +1360,7 @@ func (ld *packageLoader) updateRequirements(loaderstate *State, ctx context.Cont // imports.AnyTags, then we didn't necessarily load every package that // contributes “direct” imports — so we can't safely mark existing direct // dependencies in ld.requirements as indirect-only. Propagate them as direct. - loadedDirect := ld.allPatternIsRoot && maps.Equal(ld.Tags, imports.AnyTags()) + loadedDirect := pld.allPatternIsRoot && maps.Equal(pld.Tags, imports.AnyTags()) if loadedDirect { direct = make(map[string]bool) } else { @@ -1374,7 +1374,7 @@ func (ld *packageLoader) updateRequirements(loaderstate *State, ctx context.Cont } var maxTooNew *gover.TooNewError - for _, pkg := range ld.pkgs { + for _, pkg := range pld.pkgs { if pkg.err != nil { if tooNew, ok := errors.AsType[*gover.TooNewError](pkg.err); ok { if maxTooNew == nil || gover.Compare(tooNew.GoVersion, maxTooNew.GoVersion) > 0 { @@ -1447,7 +1447,7 @@ func (ld *packageLoader) updateRequirements(loaderstate *State, ctx context.Cont } var addRoots []module.Version - if ld.Tidy { + if pld.Tidy { // When we are tidying a module with a pruned dependency graph, we may need // to add roots to preserve the versions of indirect, test-only dependencies // that are upgraded above or otherwise missing from the go.mod files of @@ -1482,28 +1482,28 @@ func (ld *packageLoader) updateRequirements(loaderstate *State, ctx context.Cont // roots can only increase and the set of roots can only expand. The set // of extant root paths is finite and the set of versions of each path is // finite, so the iteration *must* reach a stable fixed-point. - tidy, err := tidyRoots(loaderstate, ctx, rs, ld.pkgs) + tidy, err := tidyRoots(loaderstate, ctx, rs, pld.pkgs) if err != nil { return false, err } addRoots = tidy.rootModules } - rs, err = updateRoots(loaderstate, ctx, direct, rs, ld.pkgs, addRoots, ld.AssumeRootsImported) + rs, err = updateRoots(loaderstate, ctx, direct, rs, pld.pkgs, addRoots, pld.AssumeRootsImported) if err != nil { // We don't actually know what even the root requirements are supposed to be, // so we can't proceed with loading. Return the error to the caller return false, err } - if rs.GoVersion(loaderstate) != ld.requirements.GoVersion(loaderstate) { + if rs.GoVersion(loaderstate) != pld.requirements.GoVersion(loaderstate) { // A change in the selected Go version may or may not affect the set of // loaded packages, but in some cases it can change the meaning of the "all" // pattern, the level of pruning in the module graph, and even the set of // packages present in the standard library. If it has changed, it's best to // reload packages once more to be sure everything is stable. changed = true - } else if rs != ld.requirements && !slices.Equal(rs.rootModules, ld.requirements.rootModules) { + } else if rs != pld.requirements && !slices.Equal(rs.rootModules, pld.requirements.rootModules) { // The roots of the module graph have changed in some way (not just the // "direct" markings). Check whether the changes affected any of the loaded // packages. @@ -1511,7 +1511,7 @@ func (ld *packageLoader) updateRequirements(loaderstate *State, ctx context.Cont if err != nil { return false, err } - for _, pkg := range ld.pkgs { + for _, pkg := range pld.pkgs { if pkg.fromExternalModule(loaderstate) && mg.Selected(pkg.mod.Path) != pkg.mod.Version { changed = true break @@ -1532,7 +1532,7 @@ func (ld *packageLoader) updateRequirements(loaderstate *State, ctx context.Cont // // In some sense, we can think of this as ‘upgraded the module providing // pkg.path from "none" to a version higher than "none"’. - if _, _, _, _, err = importFromModules(loaderstate, ctx, pkg.path, rs, nil, ld.skipImportModFiles); err == nil { + if _, _, _, _, err = importFromModules(loaderstate, ctx, pkg.path, rs, nil, pld.skipImportModFiles); err == nil { changed = true break } @@ -1540,7 +1540,7 @@ func (ld *packageLoader) updateRequirements(loaderstate *State, ctx context.Cont } } - ld.requirements = rs + pld.requirements = rs return changed, nil } @@ -1550,13 +1550,13 @@ func (ld *packageLoader) updateRequirements(loaderstate *State, ctx context.Cont // The newly-resolved packages are added to the addedModuleFor map, and // resolveMissingImports returns a map from each new module version to // the first missing package that module would resolve. -func (ld *packageLoader) resolveMissingImports(loaderstate *State, ctx context.Context) (modAddedBy map[module.Version]*loadPkg, err error) { +func (pld *packageLoader) resolveMissingImports(loaderstate *State, ctx context.Context) (modAddedBy map[module.Version]*loadPkg, err error) { type pkgMod struct { pkg *loadPkg mod *module.Version } var pkgMods []pkgMod - for _, pkg := range ld.pkgs { + for _, pkg := range pld.pkgs { if pkg.err == nil { continue } @@ -1572,9 +1572,9 @@ func (ld *packageLoader) resolveMissingImports(loaderstate *State, ctx context.C pkg := pkg var mod module.Version - ld.work.Add(func() { + pld.work.Add(func() { var err error - mod, err = queryImport(loaderstate, ctx, pkg.path, ld.requirements) + mod, err = queryImport(loaderstate, ctx, pkg.path, pld.requirements) if err != nil { if ime, ok := errors.AsType[*ImportMissingError](err); ok { for curstack := pkg.stack; curstack != nil; curstack = curstack.stack { @@ -1608,7 +1608,7 @@ func (ld *packageLoader) resolveMissingImports(loaderstate *State, ctx context.C pkgMods = append(pkgMods, pkgMod{pkg: pkg, mod: &mod}) } - <-ld.work.Idle() + <-pld.work.Idle() modAddedBy = map[module.Version]*loadPkg{} @@ -1651,34 +1651,34 @@ func (ld *packageLoader) resolveMissingImports(loaderstate *State, ctx context.C // ld.work queue, and its test (if requested) will also be populated once // imports have been resolved. When ld.work goes idle, all transitive imports of // the requested package (and its test, if requested) will have been loaded. -func (ld *packageLoader) pkg(loaderstate *State, ctx context.Context, path string, flags loadPkgFlags) *loadPkg { +func (pld *packageLoader) pkg(loaderstate *State, ctx context.Context, path string, flags loadPkgFlags) *loadPkg { if flags.has(pkgImportsLoaded) { panic("internal error: (*packageLoader).pkg called with pkgImportsLoaded flag set") } - pkg := ld.pkgCache.Do(path, func() *loadPkg { + pkg := pld.pkgCache.Do(path, func() *loadPkg { pkg := &loadPkg{ path: path, } - ld.applyPkgFlags(loaderstate, ctx, pkg, flags) + pld.applyPkgFlags(loaderstate, ctx, pkg, flags) - ld.work.Add(func() { ld.load(loaderstate, ctx, pkg) }) + pld.work.Add(func() { pld.load(loaderstate, ctx, pkg) }) return pkg }) - ld.applyPkgFlags(loaderstate, ctx, pkg, flags) + pld.applyPkgFlags(loaderstate, ctx, pkg, flags) return pkg } // applyPkgFlags updates pkg.flags to set the given flags and propagate the // (transitive) effects of those flags, possibly loading or enqueueing further // packages as a result. -func (ld *packageLoader) applyPkgFlags(loaderstate *State, ctx context.Context, pkg *loadPkg, flags loadPkgFlags) { +func (pld *packageLoader) applyPkgFlags(loaderstate *State, ctx context.Context, pkg *loadPkg, flags loadPkgFlags) { if flags == 0 { return } - if flags.has(pkgInAll) && ld.allPatternIsRoot && !pkg.isTest() { + if flags.has(pkgInAll) && pld.allPatternIsRoot && !pkg.isTest() { // This package matches a root pattern by virtue of being in "all". flags |= pkgIsRoot } @@ -1701,7 +1701,7 @@ func (ld *packageLoader) applyPkgFlags(loaderstate *State, ctx context.Context, // so it's ok if we call it more than is strictly necessary. wantTest := false switch { - case ld.allPatternIsRoot && loaderstate.MainModules.Contains(pkg.mod.Path): + case pld.allPatternIsRoot && loaderstate.MainModules.Contains(pkg.mod.Path): // We are loading the "all" pattern, which includes packages imported by // tests in the main module. This package is in the main module, so we // need to identify the imports of its test even if LoadTests is not set. @@ -1709,26 +1709,26 @@ func (ld *packageLoader) applyPkgFlags(loaderstate *State, ctx context.Context, // (We will filter out the extra tests explicitly in computePatternAll.) wantTest = true - case ld.allPatternIsRoot && ld.allClosesOverTests && new.has(pkgInAll): + case pld.allPatternIsRoot && pld.allClosesOverTests && new.has(pkgInAll): // This variant of the "all" pattern includes imports of tests of every // package that is itself in "all", and pkg is in "all", so its test is // also in "all" (as above). wantTest = true - case ld.LoadTests && new.has(pkgIsRoot): + case pld.LoadTests && new.has(pkgIsRoot): // LoadTest explicitly requests tests of “the root packages”. wantTest = true } if wantTest { var testFlags loadPkgFlags - if loaderstate.MainModules.Contains(pkg.mod.Path) || (ld.allClosesOverTests && new.has(pkgInAll)) { + if loaderstate.MainModules.Contains(pkg.mod.Path) || (pld.allClosesOverTests && new.has(pkgInAll)) { // Tests of packages in the main module are in "all", in the sense that // they cause the packages they import to also be in "all". So are tests // of packages in "all" if "all" closes over test dependencies. testFlags |= pkgInAll } - ld.pkgTest(loaderstate, ctx, pkg, testFlags) + pld.pkgTest(loaderstate, ctx, pkg, testFlags) } } @@ -1736,13 +1736,13 @@ func (ld *packageLoader) applyPkgFlags(loaderstate *State, ctx context.Context, // We have just marked pkg with pkgInAll, or we have just loaded its // imports, or both. Now is the time to propagate pkgInAll to the imports. for _, dep := range pkg.imports { - ld.applyPkgFlags(loaderstate, ctx, dep, pkgInAll) + pld.applyPkgFlags(loaderstate, ctx, dep, pkgInAll) } } if new.has(pkgFromRoot) && !old.has(pkgFromRoot|pkgImportsLoaded) { for _, dep := range pkg.imports { - ld.applyPkgFlags(loaderstate, ctx, dep, pkgFromRoot) + pld.applyPkgFlags(loaderstate, ctx, dep, pkgFromRoot) } } } @@ -1750,23 +1750,23 @@ func (ld *packageLoader) applyPkgFlags(loaderstate *State, ctx context.Context, // preloadRootModules loads the module requirements needed to identify the // selected version of each module providing a package in rootPkgs, // adding new root modules to the module graph if needed. -func (ld *packageLoader) preloadRootModules(loaderstate *State, ctx context.Context, rootPkgs []string) (changedBuildList bool) { +func (pld *packageLoader) preloadRootModules(loaderstate *State, ctx context.Context, rootPkgs []string) (changedBuildList bool) { needc := make(chan map[module.Version]bool, 1) needc <- map[module.Version]bool{} for _, path := range rootPkgs { path := path - ld.work.Add(func() { + pld.work.Add(func() { // First, try to identify the module containing the package using only roots. // // If the main module is tidy and the package is in "all" — or if we're // lucky — we can identify all of its imports without actually loading the // full module graph. - m, _, _, _, err := importFromModules(loaderstate, ctx, path, ld.requirements, nil, ld.skipImportModFiles) + m, _, _, _, err := importFromModules(loaderstate, ctx, path, pld.requirements, nil, pld.skipImportModFiles) if err != nil { - if _, ok := errors.AsType[*ImportMissingError](err); ok && ld.ResolveMissingImports { + if _, ok := errors.AsType[*ImportMissingError](err); ok && pld.ResolveMissingImports { // This package isn't provided by any selected module. // If we can find it, it will be a new root dependency. - m, err = queryImport(loaderstate, ctx, path, ld.requirements) + m, err = queryImport(loaderstate, ctx, path, pld.requirements) } if err != nil { // We couldn't identify the root module containing this package. @@ -1779,7 +1779,7 @@ func (ld *packageLoader) preloadRootModules(loaderstate *State, ctx context.Cont return } - v, ok := ld.requirements.rootSelected(loaderstate, m.Path) + v, ok := pld.requirements.rootSelected(loaderstate, m.Path) if !ok || v != m.Version { // We found the requested package in m, but m is not a root, so // loadModGraph will not load its requirements. We need to promote the @@ -1794,7 +1794,7 @@ func (ld *packageLoader) preloadRootModules(loaderstate *State, ctx context.Cont } }) } - <-ld.work.Idle() + <-pld.work.Idle() need := <-needc if len(need) == 0 { @@ -1807,16 +1807,16 @@ func (ld *packageLoader) preloadRootModules(loaderstate *State, ctx context.Cont } gover.ModSort(toAdd) - rs, err := updateRoots(loaderstate, ctx, ld.requirements.direct, ld.requirements, nil, toAdd, ld.AssumeRootsImported) + rs, err := updateRoots(loaderstate, ctx, pld.requirements.direct, pld.requirements, nil, toAdd, pld.AssumeRootsImported) if err != nil { // We are missing some root dependency, and for some reason we can't load // enough of the module dependency graph to add the missing root. Package // loading is doomed to fail, so fail quickly. - ld.error(err) - ld.exitIfErrors(ctx) + pld.error(err) + pld.exitIfErrors(ctx) return false } - if slices.Equal(rs.rootModules, ld.requirements.rootModules) { + if slices.Equal(rs.rootModules, pld.requirements.rootModules) { // Something is deeply wrong. resolveMissingImports gave us a non-empty // set of modules to add to the graph, but adding those modules had no // effect — either they were already in the graph, or updateRoots did not @@ -1824,16 +1824,16 @@ func (ld *packageLoader) preloadRootModules(loaderstate *State, ctx context.Cont panic(fmt.Sprintf("internal error: adding %v to module graph had no effect on root requirements (%v)", toAdd, rs.rootModules)) } - ld.requirements = rs + pld.requirements = rs return true } // load loads an individual package. -func (ld *packageLoader) load(loaderstate *State, ctx context.Context, pkg *loadPkg) { +func (pld *packageLoader) load(loaderstate *State, ctx context.Context, pkg *loadPkg) { var mg *ModuleGraph - if ld.requirements.pruning == unpruned { + if pld.requirements.pruning == unpruned { var err error - mg, err = ld.requirements.Graph(loaderstate, ctx) + mg, err = pld.requirements.Graph(loaderstate, ctx) if err != nil { // We already checked the error from Graph in loadFromRoots and/or // updateRequirements, so we ignored the error on purpose and we should @@ -1848,12 +1848,12 @@ func (ld *packageLoader) load(loaderstate *State, ctx context.Context, pkg *load } var modroot string - pkg.mod, modroot, pkg.dir, pkg.altMods, pkg.err = importFromModules(loaderstate, ctx, pkg.path, ld.requirements, mg, ld.skipImportModFiles) + pkg.mod, modroot, pkg.dir, pkg.altMods, pkg.err = importFromModules(loaderstate, ctx, pkg.path, pld.requirements, mg, pld.skipImportModFiles) if loaderstate.MainModules.Tools()[pkg.path] { // Tools declared by main modules are always in "all". // We apply the package flags before returning so that missing // tool dependencies report an error https://go.dev/issue/70582 - ld.applyPkgFlags(loaderstate, ctx, pkg, pkgInAll) + pld.applyPkgFlags(loaderstate, ctx, pkg, pkgInAll) } if pkg.dir == "" { return @@ -1868,10 +1868,10 @@ func (ld *packageLoader) load(loaderstate *State, ctx context.Context, pkg *load // about (by reducing churn on the flag bits of dependencies), and costs // essentially nothing (these atomic flag ops are essentially free compared // to scanning source code for imports). - ld.applyPkgFlags(loaderstate, ctx, pkg, pkgInAll) + pld.applyPkgFlags(loaderstate, ctx, pkg, pkgInAll) } - if ld.AllowPackage != nil { - if err := ld.AllowPackage(ctx, pkg.path, pkg.mod); err != nil { + if pld.AllowPackage != nil { + if err := pld.AllowPackage(ctx, pkg.path, pkg.mod); err != nil { pkg.err = err } } @@ -1884,7 +1884,7 @@ func (ld *packageLoader) load(loaderstate *State, ctx context.Context, pkg *load // We can't scan standard packages for gccgo. } else { var err error - imports, testImports, err = scanDir(modroot, pkg.dir, ld.Tags) + imports, testImports, err = scanDir(modroot, pkg.dir, pld.Tags) if err != nil { pkg.err = err return @@ -1900,13 +1900,13 @@ func (ld *packageLoader) load(loaderstate *State, ctx context.Context, pkg *load if pkg.inStd { // Imports from packages in "std" and "cmd" should resolve using // GOROOT/src/vendor even when "std" is not the main module. - path = ld.stdVendor(loaderstate, pkg.path, path) + path = pld.stdVendor(loaderstate, pkg.path, path) } - pkg.imports = append(pkg.imports, ld.pkg(loaderstate, ctx, path, importFlags)) + pkg.imports = append(pkg.imports, pld.pkg(loaderstate, ctx, path, importFlags)) } pkg.testImports = testImports - ld.applyPkgFlags(loaderstate, ctx, pkg, pkgImportsLoaded) + pld.applyPkgFlags(loaderstate, ctx, pkg, pkgImportsLoaded) } // pkgTest locates the test of pkg, creating it if needed, and updates its state @@ -1914,7 +1914,7 @@ func (ld *packageLoader) load(loaderstate *State, ctx context.Context, pkg *load // // pkgTest requires that the imports of pkg have already been loaded (flagged // with pkgImportsLoaded). -func (ld *packageLoader) pkgTest(loaderstate *State, ctx context.Context, pkg *loadPkg, testFlags loadPkgFlags) *loadPkg { +func (pld *packageLoader) pkgTest(loaderstate *State, ctx context.Context, pkg *loadPkg, testFlags loadPkgFlags) *loadPkg { if pkg.isTest() { panic("pkgTest called on a test package") } @@ -1929,7 +1929,7 @@ func (ld *packageLoader) pkgTest(loaderstate *State, ctx context.Context, pkg *l err: pkg.err, inStd: pkg.inStd, } - ld.applyPkgFlags(loaderstate, ctx, pkg.test, testFlags) + pld.applyPkgFlags(loaderstate, ctx, pkg.test, testFlags) createdTest = true }) @@ -1942,14 +1942,14 @@ func (ld *packageLoader) pkgTest(loaderstate *State, ctx context.Context, pkg *l } for _, path := range pkg.testImports { if pkg.inStd { - path = ld.stdVendor(loaderstate, test.path, path) + path = pld.stdVendor(loaderstate, test.path, path) } - test.imports = append(test.imports, ld.pkg(loaderstate, ctx, path, importFlags)) + test.imports = append(test.imports, pld.pkg(loaderstate, ctx, path, importFlags)) } pkg.testImports = nil - ld.applyPkgFlags(loaderstate, ctx, test, pkgImportsLoaded) + pld.applyPkgFlags(loaderstate, ctx, test, pkgImportsLoaded) } else { - ld.applyPkgFlags(loaderstate, ctx, test, testFlags) + pld.applyPkgFlags(loaderstate, ctx, test, testFlags) } return test @@ -1957,7 +1957,7 @@ func (ld *packageLoader) pkgTest(loaderstate *State, ctx context.Context, pkg *l // stdVendor returns the canonical import path for the package with the given // path when imported from the standard-library package at parentPath. -func (ld *packageLoader) stdVendor(loaderstate *State, parentPath, path string) string { +func (pld *packageLoader) stdVendor(loaderstate *State, parentPath, path string) string { if p, _, ok := fips140.ResolveImport(path); ok { return p } @@ -1966,14 +1966,14 @@ func (ld *packageLoader) stdVendor(loaderstate *State, parentPath, path string) } if str.HasPathPrefix(parentPath, "cmd") { - if !ld.VendorModulesInGOROOTSrc || !loaderstate.MainModules.Contains("cmd") { + if !pld.VendorModulesInGOROOTSrc || !loaderstate.MainModules.Contains("cmd") { vendorPath := pathpkg.Join("cmd", "vendor", path) if _, err := os.Stat(filepath.Join(cfg.GOROOTsrc, filepath.FromSlash(vendorPath))); err == nil { return vendorPath } } - } else if !ld.VendorModulesInGOROOTSrc || !loaderstate.MainModules.Contains("std") || str.HasPathPrefix(parentPath, "vendor") { + } else if !pld.VendorModulesInGOROOTSrc || !loaderstate.MainModules.Contains("std") || str.HasPathPrefix(parentPath, "vendor") { // If we are outside of the 'std' module, resolve imports from within 'std' // to the vendor directory. // @@ -1998,8 +1998,8 @@ func (ld *packageLoader) stdVendor(loaderstate *State, parentPath, path string) // computePatternAll returns the list of packages matching pattern "all", // starting with a list of the import paths for the packages in the main module. -func (ld *packageLoader) computePatternAll() (all []string) { - for _, pkg := range ld.pkgs { +func (pld *packageLoader) computePatternAll() (all []string) { + for _, pkg := range pld.pkgs { if module.CheckImportPath(pkg.path) != nil { // Don't add packages with invalid paths. This means that // we don't try to load invalid imports of the main modules' @@ -2019,9 +2019,9 @@ func (ld *packageLoader) computePatternAll() (all []string) { // or as a replacement for another module, but not both at the same time. // // (See https://golang.org/issue/26607 and https://golang.org/issue/34650.) -func (ld *packageLoader) checkMultiplePaths(loaderstate *State) { - mods := ld.requirements.rootModules - if cached := ld.requirements.graph.Load(); cached != nil { +func (pld *packageLoader) checkMultiplePaths(loaderstate *State) { + mods := pld.requirements.rootModules + if cached := pld.requirements.graph.Load(); cached != nil { if mg := cached.mg; mg != nil { mods = mg.BuildList() } @@ -2033,19 +2033,19 @@ func (ld *packageLoader) checkMultiplePaths(loaderstate *State) { if prev, ok := firstPath[src]; !ok { firstPath[src] = mod.Path } else if prev != mod.Path { - ld.error(fmt.Errorf("%s@%s used for two different module paths (%s and %s)", src.Path, src.Version, prev, mod.Path)) + pld.error(fmt.Errorf("%s@%s used for two different module paths (%s and %s)", src.Path, src.Version, prev, mod.Path)) } } } // checkTidyCompatibility emits an error if any package would be loaded from a // different module under rs than under ld.requirements. -func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context.Context, rs *Requirements, compatVersion string) { +func (pld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context.Context, rs *Requirements, compatVersion string) { goVersion := rs.GoVersion(loaderstate) suggestUpgrade := false suggestEFlag := false suggestFixes := func() { - if ld.AllowErrors { + if pld.AllowErrors { // The user is explicitly ignoring these errors, so don't bother them with // other options. return @@ -2089,10 +2089,10 @@ func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context. mg, err := rs.Graph(loaderstate, ctx) if err != nil { - ld.error(fmt.Errorf("error loading go %s module graph: %w", compatVersion, err)) - ld.switchIfErrors(ctx) + pld.error(fmt.Errorf("error loading go %s module graph: %w", compatVersion, err)) + pld.switchIfErrors(ctx) suggestFixes() - ld.exitIfErrors(ctx) + pld.exitIfErrors(ctx) return } @@ -2116,7 +2116,7 @@ func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context. } mismatchMu := make(chan map[*loadPkg]mismatch, 1) mismatchMu <- map[*loadPkg]mismatch{} - for _, pkg := range ld.pkgs { + for _, pkg := range pld.pkgs { if pkg.mod.Path == "" && pkg.err == nil { // This package is from the standard library (which does not vary based on // the module graph). @@ -2124,8 +2124,8 @@ func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context. } pkg := pkg - ld.work.Add(func() { - mod, _, _, _, err := importFromModules(loaderstate, ctx, pkg.path, rs, mg, ld.skipImportModFiles) + pld.work.Add(func() { + mod, _, _, _, err := importFromModules(loaderstate, ctx, pkg.path, rs, mg, pld.skipImportModFiles) if mod != pkg.mod { mismatches := <-mismatchMu mismatches[pkg] = mismatch{mod: mod, err: err} @@ -2133,7 +2133,7 @@ func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context. } }) } - <-ld.work.Idle() + <-pld.work.Idle() mismatches := <-mismatchMu if len(mismatches) == 0 { @@ -2148,7 +2148,7 @@ func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context. // we'll double-check that our reasoning above actually holds — if it // doesn't, we'll emit an internal error and hopefully the user will report // it as a bug. - for _, m := range ld.requirements.rootModules { + for _, m := range pld.requirements.rootModules { if v := mg.Selected(m.Path); v != m.Version { fmt.Fprintln(os.Stderr) base.Fatalf("go: internal error: failed to diagnose selected-version mismatch for module %s: go %s selects %s, but go %s selects %s\n\tPlease report this at https://go.dev/issue.", m.Path, goVersion, m.Version, compatVersion, v) @@ -2159,7 +2159,7 @@ func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context. // Iterate over the packages (instead of the mismatches map) to emit errors in // deterministic order. - for _, pkg := range ld.pkgs { + for _, pkg := range pld.pkgs { mismatch, ok := mismatches[pkg] if !ok { continue @@ -2192,12 +2192,12 @@ func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context. Path: pkg.mod.Path, Version: mg.Selected(pkg.mod.Path), } - ld.error(fmt.Errorf("%s loaded from %v,\n\tbut go %s would fail to locate it in %s", pkg.stackText(), pkg.mod, compatVersion, selected)) + pld.error(fmt.Errorf("%s loaded from %v,\n\tbut go %s would fail to locate it in %s", pkg.stackText(), pkg.mod, compatVersion, selected)) } else { if _, ok := errors.AsType[*AmbiguousImportError](mismatch.err); ok { // TODO: Is this check needed? } - ld.error(fmt.Errorf("%s loaded from %v,\n\tbut go %s would fail to locate it:\n\t%v", pkg.stackText(), pkg.mod, compatVersion, mismatch.err)) + pld.error(fmt.Errorf("%s loaded from %v,\n\tbut go %s would fail to locate it:\n\t%v", pkg.stackText(), pkg.mod, compatVersion, mismatch.err)) } suggestEFlag = true @@ -2210,7 +2210,7 @@ func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context. // We check for that condition here. If all of the roots are consistent // the '-e' flag suffices, but otherwise we need to suggest an upgrade. if !suggestUpgrade { - for _, m := range ld.requirements.rootModules { + for _, m := range pld.requirements.rootModules { if v := mg.Selected(m.Path); v != m.Version { suggestUpgrade = true break @@ -2235,7 +2235,7 @@ func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context. // pkg.err should have already been logged elsewhere — along with a // stack trace — so log only the import path and non-error info here. suggestUpgrade = true - ld.error(fmt.Errorf("%s failed to load from any module,\n\tbut go %s would load it from %v", pkg.path, compatVersion, mismatch.mod)) + pld.error(fmt.Errorf("%s failed to load from any module,\n\tbut go %s would load it from %v", pkg.path, compatVersion, mismatch.mod)) case pkg.mod != mismatch.mod: // The package is loaded successfully by both Go versions, but from a @@ -2243,16 +2243,16 @@ func (ld *packageLoader) checkTidyCompatibility(loaderstate *State, ctx context. // unnoticed!) variations in behavior between builds with different // toolchains. suggestUpgrade = true - ld.error(fmt.Errorf("%s loaded from %v,\n\tbut go %s would select %v\n", pkg.stackText(), pkg.mod, compatVersion, mismatch.mod.Version)) + pld.error(fmt.Errorf("%s loaded from %v,\n\tbut go %s would select %v\n", pkg.stackText(), pkg.mod, compatVersion, mismatch.mod.Version)) default: base.Fatalf("go: internal error: mismatch recorded for package %s, but no differences found", pkg.path) } } - ld.switchIfErrors(ctx) + pld.switchIfErrors(ctx) suggestFixes() - ld.exitIfErrors(ctx) + pld.exitIfErrors(ctx) } // scanDir is like imports.ScanDir but elides known magic imports from the list, @@ -2300,28 +2300,28 @@ Happy: // package up the import stack in their minimal chain. // As a side effect, buildStacks also constructs ld.pkgs, // the list of all packages loaded. -func (ld *packageLoader) buildStacks() { - if len(ld.pkgs) > 0 { +func (pld *packageLoader) buildStacks() { + if len(pld.pkgs) > 0 { panic("buildStacks") } - for _, pkg := range ld.roots { + for _, pkg := range pld.roots { pkg.stack = pkg // sentinel to avoid processing in next loop - ld.pkgs = append(ld.pkgs, pkg) + pld.pkgs = append(pld.pkgs, pkg) } - for i := 0; i < len(ld.pkgs); i++ { // not range: appending to ld.pkgs in loop - pkg := ld.pkgs[i] + for i := 0; i < len(pld.pkgs); i++ { // not range: appending to ld.pkgs in loop + pkg := pld.pkgs[i] for _, next := range pkg.imports { if next.stack == nil { next.stack = pkg - ld.pkgs = append(ld.pkgs, next) + pld.pkgs = append(pld.pkgs, next) } } if next := pkg.test; next != nil && next.stack == nil { next.stack = pkg - ld.pkgs = append(ld.pkgs, next) + pld.pkgs = append(pld.pkgs, next) } } - for _, pkg := range ld.roots { + for _, pkg := range pld.roots { pkg.stack = nil } } |
