Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: add a Latest field to the output of 'go mod download -json'
Fixes #32239 Change-Id: I5723abaa9b6bed7e8fb2d95f749a4e03ecc8741b Reviewed-on: https://go-review.googlesource.com/c/go/+/183841 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
- Loading branch information
Bryan C. Mills
committed
Jul 10, 2019
1 parent
726b1bf
commit 0067586
Showing
5 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,20 @@ | ||
env GO111MODULE=on | ||
|
||
# If the module is the latest version of itself, | ||
# the Latest field should be set. | ||
go mod download -json rsc.io/quote@v1.5.2 | ||
stdout '"Latest":\s*true' | ||
|
||
# If the module is older than latest, the field should be unset. | ||
go mod download -json rsc.io/quote@v1.5.1 | ||
! stdout '"Latest":' | ||
|
||
# If the module is newer than "latest", the field should be unset... | ||
go mod download -json rsc.io/quote@v1.5.3-pre1 | ||
! stdout '"Latest":' | ||
|
||
# ...even if that version is also what is required by the main module. | ||
go mod init example.com | ||
go mod edit -require rsc.io/quote@v1.5.3-pre1 | ||
go mod download -json rsc.io/quote@v1.5.3-pre1 | ||
! stdout '"Latest":' |
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 |
---|---|---|
@@ -1,8 +1,28 @@ | ||
env GO111MODULE=on | ||
|
||
# If the current version is not latest, 'go list -u' should include its upgrade. | ||
go list -m -u all | ||
stdout 'rsc.io/quote v1.2.0 \[v1\.5\.2\]' | ||
|
||
# If the current version is latest, 'go list -u' should omit the upgrade. | ||
go get -d rsc.io/quote@v1.5.2 | ||
go list -m -u all | ||
stdout 'rsc.io/quote v1.5.2$' | ||
|
||
# If the current version is newer than latest, 'go list -u' should | ||
# omit the upgrade. | ||
go get -d rsc.io/quote@v1.5.3-pre1 | ||
go list -m -u all | ||
stdout 'rsc.io/quote v1.5.3-pre1$' | ||
|
||
# If the current build list has a higher version and the user asks about | ||
# a lower one, -u should report the upgrade for the lower one | ||
# but leave the build list unchanged. | ||
go list -m -u rsc.io/quote@v1.5.1 | ||
stdout 'rsc.io/quote v1.5.1 \[v1.5.2\]$' | ||
go list -m -u rsc.io/quote | ||
stdout 'rsc.io/quote v1.5.3-pre1$' | ||
|
||
-- go.mod -- | ||
module x | ||
require rsc.io/quote v1.2.0 |