1
0
mirror of https://github.com/golang/go synced 2024-11-17 11:54:54 -07:00

cmd/go/internal/mvs: Delete redundant searching for maximum versions in building minimal requirement list

This commit is contained in:
penglei 2021-12-25 21:51:13 +08:00
parent c386269ed8
commit fce11d3c72

View File

@ -194,6 +194,11 @@ func Req(mainModule module.Version, base []string, reqs Reqs) ([]module.Version,
// that list came from a previous operation that paged
// in all the requirements, so there's no I/O to overlap now.
max := map[string]string{}
for _, m := range list {
max[m.Path] = m.Version
}
// Compute postorder, cache requirements.
var postorder []module.Version
reqCache := map[module.Version][]module.Version{}
@ -236,14 +241,6 @@ func Req(mainModule module.Version, base []string, reqs Reqs) ([]module.Version,
}
return nil
}
max := map[string]string{}
for _, m := range list {
if v, ok := max[m.Path]; ok {
max[m.Path] = reqs.Max(m.Version, v)
} else {
max[m.Path] = m.Version
}
}
// First walk the base modules that must be listed.
var min []module.Version
haveBase := map[string]bool{}