devtools/cmd/seeddb: filter stdlib versions
It's relatively expensive to fetch a stdlib module version, so when
std@all is specified, only fetch the minor versions (ones with a patch
version of 0).
Trust: Julie Qiu
Run-TryBot: Julie Qiu
@@ -94,14 +94,25 @@ func run(ctx context.Context, db *postgres.DB, proxyURL string) error {
vers := []string{m.version}
if m.version == "all" {
if m.path == stdlib.ModulePath {
- vers, err = stdlib.Versions()
+ stdVersions, err := stdlib.Versions()
+ if err != nil {
+ return err
+ }
+ // As an optimization, only fetch release versions for the
+ // standard library.
+ vers = nil
+ for _, v := range stdVersions {
+ if strings.HasSuffix(v, ".0") {
+ vers = append(vers, v)
+ }
+ }
} else {
vers, err = proxyClient.Versions(ctx, m.path)
- }
if err != nil {
return err
}
}
+ }
for _, v := range vers {
v := v
g.Go(func() error {
