//
// Usage:
//
-// go mod download [-json] [modules]
+// go mod download [-x] [-json] [modules]
//
// Download downloads the named modules, which can be module patterns selecting
// dependencies of the main module or module queries of the form path@version.
// GoModSum string // checksum for go.mod (as in go.sum)
// }
//
+// The -x flag causes download to print the commands download executes.
+//
// See 'go help modules' for more about module queries.
//
//
)
var cmdDownload = &base.Command{
- UsageLine: "go mod download [-json] [modules]",
+ UsageLine: "go mod download [-x] [-json] [modules]",
Short: "download modules to local cache",
Long: `
Download downloads the named modules, which can be module patterns selecting
GoModSum string // checksum for go.mod (as in go.sum)
}
+The -x flag causes download to print the commands download executes.
+
See 'go help modules' for more about module queries.
`,
}
func init() {
cmdDownload.Run = runDownload // break init cycle
+ // TODO(jayconrod): https://golang.org/issue/35849 Apply -x to other 'go mod' commands.
+ cmdDownload.Flag.BoolVar(&cfg.BuildX, "x", false, "")
work.AddModCommonFlags(cmdDownload)
}
# download with version should print nothing
go mod download rsc.io/quote@v1.5.0
! stdout .
+! stderr .
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod
go mod download rsc.io/quote@v1.2.1
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.2.1.zip
+# download -x with version should print
+# the underlying commands such as contacting GOPROXY.
+go mod download -x rsc.io/quote@v1.0.0
+! stdout .
+stderr 'get '$GOPROXY
+
-- go.mod --
module m