work: par.NewQueue(runtime.GOMAXPROCS(0)),
}
- addedModuleFor := make(map[string]bool)
for {
ld.reset()
// We've loaded as much as we can without resolving missing imports.
break
}
- modAddedBy := ld.resolveMissingImports(ctx, addedModuleFor)
+ modAddedBy := ld.resolveMissingImports(ctx)
if len(modAddedBy) == 0 {
break
}
// 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 *loader) resolveMissingImports(ctx context.Context, addedModuleFor map[string]bool) (modAddedBy map[module.Version]*loadPkg) {
+func (ld *loader) resolveMissingImports(ctx context.Context) (modAddedBy map[module.Version]*loadPkg) {
var needPkgs []*loadPkg
for _, pkg := range ld.pkgs {
if pkg.err == nil {
}
fmt.Fprintf(os.Stderr, "go: found %s in %s %s\n", pkg.path, pkg.mod.Path, pkg.mod.Version)
- if addedModuleFor[pkg.path] {
- // TODO(bcmills): This should only be an error if pkg.mod is the same
- // version we already tried to add previously.
- base.Fatalf("go: %s: looping trying to add package", pkg.stackText())
- }
if modAddedBy[pkg.mod] == nil {
modAddedBy[pkg.mod] = pkg
}