github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/go/internal/modcmd/download.go (about) 1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package modcmd 6 7 import ( 8 "github.com/shogo82148/std/context" 9 10 "github.com/shogo82148/std/cmd/go/internal/modfetch/codehost" 11 ) 12 13 // A ModuleJSON describes the result of go mod download. 14 type ModuleJSON struct { 15 Path string `json:",omitempty"` 16 Version string `json:",omitempty"` 17 Query string `json:",omitempty"` 18 Error string `json:",omitempty"` 19 Info string `json:",omitempty"` 20 GoMod string `json:",omitempty"` 21 Zip string `json:",omitempty"` 22 Dir string `json:",omitempty"` 23 Sum string `json:",omitempty"` 24 GoModSum string `json:",omitempty"` 25 26 Origin *codehost.Origin `json:",omitempty"` 27 Reuse bool `json:",omitempty"` 28 } 29 30 // DownloadModule runs 'go mod download' for m.Path@m.Version, 31 // leaving the results (including any error) in m itself. 32 func DownloadModule(ctx context.Context, m *ModuleJSON) error