From 942886137879015032a9671c7effc9dd77ef4150 Mon Sep 17 00:00:00 2001 From: Jay Conrod Date: Mon, 19 Aug 2019 12:52:06 -0400 Subject: [PATCH] cmd/go: document /@latest endpoint in 'go help goproxy' Updates #32789 Change-Id: Ie5e8e3b7b6a923aa9068c8af3ac8f081bd92c830 Reviewed-on: https://go-review.googlesource.com/c/go/+/190838 Reviewed-by: Bryan C. Mills Run-TryBot: Bryan C. Mills TryBot-Result: Gobot Gobot --- src/cmd/go/alldocs.go | 19 +++++++++++++++++-- src/cmd/go/internal/modfetch/proxy.go | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 2caa8e78f4..36fa528a90 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -2062,8 +2062,8 @@ // // The GET requests sent to a Go module proxy are: // -// GET $GOPROXY//@v/list returns a list of all known versions of the -// given module, one per line. +// GET $GOPROXY//@v/list returns a list of known versions of the given +// module, one per line. // // GET $GOPROXY//@v/.info returns JSON-formatted metadata // about that version of the given module. @@ -2074,6 +2074,21 @@ // GET $GOPROXY//@v/.zip returns the zip archive // for that version of the given module. // +// GET $GOPROXY//@latest returns JSON-formatted metadata about the +// latest known version of the given module in the same format as +// /@v/.info. The latest version should be the version of +// the module the go command may use if /@v/list is empty or no +// listed version is suitable. /@latest is optional and may not +// be implemented by a module proxy. +// +// When resolving the latest version of a module, the go command will request +// /@v/list, then, if no suitable versions are found, /@latest. +// The go command prefers, in order: the semantically highest release version, +// the semantically highest pre-release version, and the chronologically +// most recent pseudo-version. In Go 1.12 and earlier, the go command considered +// pseudo-versions in /@v/list to be pre-release versions, but this is +// no longer true since Go 1.13. +// // To avoid problems when serving from case-sensitive file systems, // the and elements are case-encoded, replacing every // uppercase letter with an exclamation mark followed by the corresponding diff --git a/src/cmd/go/internal/modfetch/proxy.go b/src/cmd/go/internal/modfetch/proxy.go index a3a27abf77..8f75ad92a8 100644 --- a/src/cmd/go/internal/modfetch/proxy.go +++ b/src/cmd/go/internal/modfetch/proxy.go @@ -38,8 +38,8 @@ can be a module proxy. The GET requests sent to a Go module proxy are: -GET $GOPROXY//@v/list returns a list of all known versions of the -given module, one per line. +GET $GOPROXY//@v/list returns a list of known versions of the given +module, one per line. GET $GOPROXY//@v/.info returns JSON-formatted metadata about that version of the given module. @@ -50,6 +50,21 @@ for that version of the given module. GET $GOPROXY//@v/.zip returns the zip archive for that version of the given module. +GET $GOPROXY//@latest returns JSON-formatted metadata about the +latest known version of the given module in the same format as +/@v/.info. The latest version should be the version of +the module the go command may use if /@v/list is empty or no +listed version is suitable. /@latest is optional and may not +be implemented by a module proxy. + +When resolving the latest version of a module, the go command will request +/@v/list, then, if no suitable versions are found, /@latest. +The go command prefers, in order: the semantically highest release version, +the semantically highest pre-release version, and the chronologically +most recent pseudo-version. In Go 1.12 and earlier, the go command considered +pseudo-versions in /@v/list to be pre-release versions, but this is +no longer true since Go 1.13. + To avoid problems when serving from case-sensitive file systems, the and elements are case-encoded, replacing every uppercase letter with an exclamation mark followed by the corresponding -- 2.50.0