diff options
author | Bryan C. Mills <bcmills@google.com> | 2019-10-03 18:55:59 +0000 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2019-10-04 20:06:56 +0000 |
commit | 961837dec23f900bbf8b04230c72397a0aab4be6 (patch) | |
tree | 8a7c515fd3cfe1362f0c3d99fbd611d874007cfc /src/cmd/go/internal/modcmd/download.go | |
parent | 047141797c160430c9f41e1225bbfbf562fd7795 (diff) | |
download | go-961837dec23f900bbf8b04230c72397a0aab4be6.tar.gz go-961837dec23f900bbf8b04230c72397a0aab4be6.zip |
Revert "cmd/go: add a Latest field to the output of 'go mod download -json'"
This reverts CL 183841.
Fixes #34533
Reason for revert: Introduced a significant performance regression for repos with many incompatible-version tags.
Change-Id: I75d7fd76e6e1a0902b114b00167b38439e0f8221
Reviewed-on: https://go-review.googlesource.com/c/go/+/198699
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modcmd/download.go')
-rw-r--r-- | src/cmd/go/internal/modcmd/download.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/cmd/go/internal/modcmd/download.go b/src/cmd/go/internal/modcmd/download.go index 60d0d5b6e2..0d432e9549 100644 --- a/src/cmd/go/internal/modcmd/download.go +++ b/src/cmd/go/internal/modcmd/download.go @@ -43,7 +43,6 @@ corresponding to this Go struct: Dir string // absolute path to cached source root directory Sum string // checksum for path, version (as in go.sum) GoModSum string // checksum for go.mod (as in go.sum) - Latest bool // would @latest resolve to this version? } See 'go help modules' for more about module queries. @@ -66,7 +65,6 @@ type moduleJSON struct { Dir string `json:",omitempty"` Sum string `json:",omitempty"` GoModSum string `json:",omitempty"` - Latest bool `json:",omitempty"` } func runDownload(cmd *base.Command, args []string) { @@ -105,31 +103,6 @@ func runDownload(cmd *base.Command, args []string) { work.Add(m) } - latest := map[string]string{} // path → version - if *downloadJSON { - // We need to populate the Latest field, but if the main module depends on a - // version newer than latest — or if the version requested on the command - // line is itself newer than latest — that's not trivial to determine from - // the info returned by ListModules. Instead, we issue a separate - // ListModules request for "latest", which should be inexpensive relative to - // downloading the modules. - var latestArgs []string - for _, m := range mods { - if m.Error != "" { - continue - } - latestArgs = append(latestArgs, m.Path+"@latest") - } - - if len(latestArgs) > 0 { - for _, info := range modload.ListModules(latestArgs, listU, listVersions) { - if info.Version != "" { - latest[info.Path] = info.Version - } - } - } - } - work.Do(10, func(item interface{}) { m := item.(*moduleJSON) var err error @@ -160,9 +133,6 @@ func runDownload(cmd *base.Command, args []string) { m.Error = err.Error() return } - if latest[m.Path] == m.Version { - m.Latest = true - } }) if *downloadJSON { |