internal/proxy: clarify that Info can return @latest

Change-Id: I4cd990a0f1189f5a7841de941a572a9a44c19632
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/294632
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
This commit is contained in:
Jonathan Amsterdam 2021-02-20 09:44:24 -05:00
Родитель 1761d9bf3b
Коммит ad24e8b060
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -71,13 +71,15 @@ func (c *Client) WithFetchDisabled() *Client {
// Info makes a request to $GOPROXY/<module>/@v/<requestedVersion>.info and
// transforms that data into a *VersionInfo.
// If requestedVersion is internal.LatestVersion, it uses the proxy's @latest
// endpoint instead.
func (c *Client) Info(ctx context.Context, modulePath, requestedVersion string) (_ *VersionInfo, err error) {
defer func() {
wrap := derrors.Wrap
if !errors.Is(err, derrors.NotFound) && !errors.Is(err, derrors.ProxyTimedOut) {
wrap = derrors.WrapAndReport
}
wrap(&err, "proxy.Client.getInfo(%q, %q)", modulePath, requestedVersion)
wrap(&err, "proxy.Client.Info(%q, %q)", modulePath, requestedVersion)
}()
data, err := c.readBody(ctx, modulePath, requestedVersion, "info")
if err != nil {