aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/query.go
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2019-06-17 17:03:55 -0400
committerJay Conrod <jayconrod@google.com>2019-06-18 00:18:19 +0000
commit53f628e56029573729ce6ac8844f87cc08f62a7a (patch)
treebf3b24c387d2d5fc7e65e50ad37e01fe3dbb6e38 /src/cmd/go/internal/modload/query.go
parent263db9b6801ed9b05250da6f05ce93038e37c59c (diff)
downloadgo-53f628e56029573729ce6ac8844f87cc08f62a7a.tar.gz
go-53f628e56029573729ce6ac8844f87cc08f62a7a.zip
cmd/go/internal/modload: query correct "latest" version through proxy
This fixes a regression introduced in CL 180337. When we query a module at "latest" that has no tagged versions, we tried to use "" as the version because we used info.Name instead of info.Version. This only happened when using a proxy: in direct mode, info.Name is set to the underlying VCS revision, which is fine. Also: serve "/mod/path/@latest" through our test proxy. Previously, we served a 404, which made this bug hard to detect. Fixes #32636 Change-Id: I5c60975656297f862cad66675170e819685ebd39 Reviewed-on: https://go-review.googlesource.com/c/go/+/182697 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/modload/query.go')
-rw-r--r--src/cmd/go/internal/modload/query.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modload/query.go b/src/cmd/go/internal/modload/query.go
index 9cd7881696..614592806d 100644
--- a/src/cmd/go/internal/modload/query.go
+++ b/src/cmd/go/internal/modload/query.go
@@ -241,7 +241,7 @@ func queryProxy(proxy, path, query, current string, allowed func(module.Version)
// Special case for "latest": if no tags match, use latest commit in repo,
// provided it is not excluded.
if latest, err := repo.Latest(); err == nil && allowed(module.Version{Path: path, Version: latest.Version}) {
- return lookup(latest.Name)
+ return lookup(latest.Version)
}
}