-
Notifications
You must be signed in to change notification settings - Fork 17.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Jay Conrod
committed
Jun 18, 2019
1 parent
263db9b
commit 53f628e
Showing
4 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/cmd/go/testdata/mod/example.com_notags_v0.0.0-20190507143103-cc8cbe209b64.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Written by hand. | ||
The "latest" version of a module without any tags. | ||
|
||
-- .mod -- | ||
module example.com/notags | ||
-- .info -- | ||
{"Version":"v0.0.0-20190507143103-cc8cbe209b64","Time":"2019-05-07T07:31:03-07:00"} | ||
-- notags.go -- | ||
package notags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Check that we can build a module with no tagged versions by querying | ||
# "@latest" through a proxy. | ||
# Verifies golang.org/issue/32636 | ||
|
||
env GO111MODULE=on | ||
|
||
go mod init m | ||
go list example.com/notags | ||
go list -m all | ||
stdout '^example.com/notags v0.0.0-20190507143103-cc8cbe209b64$' |