]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/modcmd: remove references to modfetch.Fetcher_
authorIan Alexander <jitsu@google.com>
Mon, 24 Nov 2025 23:36:07 +0000 (18:36 -0500)
committerIan Alexander <jitsu@google.com>
Wed, 26 Nov 2025 17:30:54 +0000 (09:30 -0800)
This commit removes references to the global modfetch.Fetcher_
variable from the modcmd package.

Change-Id: Ie2966401d1f6964e21ddede65d39ff53fea6e867
Reviewed-on: https://go-review.googlesource.com/c/go/+/724245
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
src/cmd/go/internal/modcmd/download.go

index 8b94ba1fd57c701470aa76266a477b3dc714c429..661cddcd79de64b38273b4db74bd18ddedf45f73 100644 (file)
@@ -264,7 +264,7 @@ func runDownload(ctx context.Context, cmd *base.Command, args []string) {
                }
                sem <- token{}
                go func() {
-                       err := DownloadModule(ctx, m)
+                       err := DownloadModule(ctx, moduleLoaderState.Fetcher(), m)
                        if err != nil {
                                downloadErrs.Store(m, err)
                                m.Error = err.Error()
@@ -364,27 +364,27 @@ func runDownload(ctx context.Context, cmd *base.Command, args []string) {
 
 // DownloadModule runs 'go mod download' for m.Path@m.Version,
 // leaving the results (including any error) in m itself.
-func DownloadModule(ctx context.Context, m *ModuleJSON) error {
+func DownloadModule(ctx context.Context, f *modfetch.Fetcher, m *ModuleJSON) error {
        var err error
-       _, file, err := modfetch.Fetcher_.InfoFile(ctx, m.Path, m.Version)
+       _, file, err := f.InfoFile(ctx, m.Path, m.Version)
        if err != nil {
                return err
        }
        m.Info = file
-       m.GoMod, err = modfetch.Fetcher_.GoModFile(ctx, m.Path, m.Version)
+       m.GoMod, err = f.GoModFile(ctx, m.Path, m.Version)
        if err != nil {
                return err
        }
-       m.GoModSum, err = modfetch.Fetcher_.GoModSum(ctx, m.Path, m.Version)
+       m.GoModSum, err = f.GoModSum(ctx, m.Path, m.Version)
        if err != nil {
                return err
        }
        mod := module.Version{Path: m.Path, Version: m.Version}
-       m.Zip, err = modfetch.Fetcher_.DownloadZip(ctx, mod)
+       m.Zip, err = f.DownloadZip(ctx, mod)
        if err != nil {
                return err
        }
        m.Sum = modfetch.Sum(ctx, mod)
-       m.Dir, err = modfetch.Fetcher_.Download(ctx, mod)
+       m.Dir, err = f.Download(ctx, mod)
        return err
 }