modload.AllowWriteGoMod()
        modload.WriteGoMod()
        modload.DisallowWriteGoMod()
-
-       // Ensure .info files are cached for each module in the build list.
-       // This ensures 'go list -m all' can succeed later if offline.
-       // 'go get' only loads .info files for queried versions. 'go list -m' needs
-       // them to add timestamps to the output.
-       //
-       // This is best effort since build commands don't need .info files to load
-       // the build list.
-       //
-       // TODO(golang.org/issue/40775): ListModules resets modload.loader, which
-       // contains information about direct dependencies that WriteGoMod uses.
-       // Refactor to avoid these kinds of global side effects.
-       if modload.HasModRoot() {
-               modload.ListModules(ctx, []string{"all"}, false, false, false)
-       }
 }
 
 // parseArgs parses command-line arguments and reports errors.
 
 env GONOPROXY=none # that is, proxy all despite GOPRIVATE
 go get -d rsc.io/quote
 
+# Download .info files needed for 'go list -m all' later.
+# TODO(#42723): either 'go list -m' should not read these files,
+# or 'go get' and 'go mod tidy' should download them.
+go list -m all  
+stdout '^golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c$'
+
 # When GOPROXY is not empty but contains no entries, an error should be reported.
 env GOPROXY=','
 ! go get -d golang.org/x/text