diff options
author | Jay Conrod <jayconrod@google.com> | 2019-11-11 14:24:00 -0500 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2019-11-11 20:19:06 +0000 |
commit | d43180429552dd09ba98f1af7bd25c245cf8531e (patch) | |
tree | 2e99b92a68352c3877bf4e437d8813b31117a925 /src/cmd/go/internal/modcmd/download.go | |
parent | b1159bad99db43e3f1b114e16c913d0e28387160 (diff) | |
download | go-d43180429552dd09ba98f1af7bd25c245cf8531e.tar.gz go-d43180429552dd09ba98f1af7bd25c245cf8531e.zip |
cmd/go/internal/modcmd: skip modules with empty version strings
This CL restores behavior before CL 189797 and fixes a misleading
comment. modload.ListModules may return info without a version for the
main module and for modules replaced with local directories.
Fixes #35505
Change-Id: I5b4e68053a680ff897b072fdf6e7aa17b6e1ac34
Reviewed-on: https://go-review.googlesource.com/c/go/+/206538
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <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 | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/go/internal/modcmd/download.go b/src/cmd/go/internal/modcmd/download.go index 6ea18ea872..768ce94f39 100644 --- a/src/cmd/go/internal/modcmd/download.go +++ b/src/cmd/go/internal/modcmd/download.go @@ -89,7 +89,7 @@ func runDownload(cmd *base.Command, args []string) { for _, arg := range args { switch arg { case modload.Target.Path, targetAtLatest, targetAtUpgrade, targetAtPatch: - os.Stderr.WriteString("go mod download: skipping argument "+ arg + " that resolves to the main module\n") + os.Stderr.WriteString("go mod download: skipping argument " + arg + " that resolves to the main module\n") } } } @@ -102,9 +102,9 @@ func runDownload(cmd *base.Command, args []string) { if info.Replace != nil { info = info.Replace } - if (module.Version{Path: info.Path, Version: info.Version} == modload.Target) { - // skipping main module. - // go mod download without dependencies is silent. + if info.Version == "" && info.Error == nil { + // main module or module replaced with file path. + // Nothing to download. continue } m := &moduleJSON{ |