diff options
author | Jay Conrod <jayconrod@google.com> | 2020-11-16 16:27:19 -0500 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2020-11-17 18:28:55 +0000 |
commit | 01df2febf5f00b1dcba1843093ef99b338b23546 (patch) | |
tree | 15512ceb6d0e62a352f88a03b1af6b02e8bb2e72 /src/cmd/go/internal/modcmd/download.go | |
parent | 0968d2d599189229145b1000cec55d9df47fbc98 (diff) | |
download | go-01df2febf5f00b1dcba1843093ef99b338b23546.tar.gz go-01df2febf5f00b1dcba1843093ef99b338b23546.zip |
cmd/go: allow querying other versions of the main module
'go mod download' and a few other commands can now query specific
versions of the main module.
'go get' still reports an error when attempting to update the main
module.
Fixes #42524
Change-Id: Ia93ef8f5f34443e938667c48a0db432200108c63
Reviewed-on: https://go-review.googlesource.com/c/go/+/270520
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modcmd/download.go')
-rw-r--r-- | src/cmd/go/internal/modcmd/download.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/cmd/go/internal/modcmd/download.go b/src/cmd/go/internal/modcmd/download.go index e2e8ba6825..ef1ad780c8 100644 --- a/src/cmd/go/internal/modcmd/download.go +++ b/src/cmd/go/internal/modcmd/download.go @@ -88,12 +88,11 @@ func runDownload(ctx context.Context, cmd *base.Command, args []string) { args = []string{"all"} } else if modload.HasModRoot() { modload.LoadModFile(ctx) // to fill Target - targetAtLatest := modload.Target.Path + "@latest" targetAtUpgrade := modload.Target.Path + "@upgrade" targetAtPatch := modload.Target.Path + "@patch" for _, arg := range args { switch arg { - case modload.Target.Path, targetAtLatest, targetAtUpgrade, targetAtPatch: + case modload.Target.Path, targetAtUpgrade, targetAtPatch: os.Stderr.WriteString("go mod download: skipping argument " + arg + " that resolves to the main module\n") } } @@ -170,7 +169,7 @@ func runDownload(ctx context.Context, cmd *base.Command, args []string) { for _, m := range mods { b, err := json.MarshalIndent(m, "", "\t") if err != nil { - base.Fatalf("%v", err) + base.Fatalf("go mod download: %v", err) } os.Stdout.Write(append(b, '\n')) if m.Error != "" { @@ -180,7 +179,7 @@ func runDownload(ctx context.Context, cmd *base.Command, args []string) { } else { for _, m := range mods { if m.Error != "" { - base.Errorf("%s", m.Error) + base.Errorf("go mod download: %v", m.Error) } } base.ExitIfErrors() |