Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: behavior of @latest is confusing #32846

Closed
bcmills opened this issue Jun 28, 2019 · 2 comments
Closed

cmd/go: behavior of @latest is confusing #32846

bcmills opened this issue Jun 28, 2019 · 2 comments
Assignees
Milestone

Comments

@bcmills
Copy link
Member

@bcmills bcmills commented Jun 28, 2019

In the Go 1.13 cycle, we made a couple of changes to go get -u:

  • We made get -u equivalent to applying @latest to dependencies recursively.
    • This was done to make the relationship between -u and @latest parallel to -u=patch and @patch.
  • We made get -u not downgrade from versions newer than the latest tagged release (#30634).

Those changes individually makes sense, but combined they produce a counter-intuitive result: an explicit go get foo@latest does not downgrade to the latest release, when it arguably should. That makes issues like #32805 more subtle to diagnose, because commands like go get golang.org/x/tools/gopls@latest are unexpectedly sensitive to the initial state.

I talked with @jayconrod and @rsc about this result, and we have a consensus about what to do about it. The current plan (for Go 1.13!) is:

  • Add an @upgrade suffix, with the meaning “@latest, but only if newer than the active version”.
  • Make -u without arguments apply @upgrade (instead of @latest) to the named arguments and their dependencies.
  • Reject -u=latest (as it was in Go 1.12), so that the supported arguments to -u are only those whose behavior depends on the active version.
    • But continue to support @latest as an explicit suffix, with its meaning from Go 1.12 (always the latest release version, even if that is a downgrade from the currently active version).
  • For arguments passed to go get without an explicit suffix:
    • Retain the current (go1.13beta1) behavior of -u=patch, which implicitly adds the @patch suffix.
    • Retain the current (go1.13beta1) behavior when -u is unset, which upgrades (but does not downgrade) only the named arguments.
      • This behavior will now corresponds to the @upgrade suffix instead of @latest.

@jayconrod has volunteered to implement this fix.

CC @thepudds @myitcv @leitzler @hyangah

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 1, 2019

Change https://golang.org/cl/184440 mentions this issue: cmd/go: restore @latest behavior and support @upgrade in 'go get'

@gopherbot gopherbot closed this in a3a0cc2 Jul 3, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 3, 2019

Change https://golang.org/cl/184920 mentions this issue: cmd/go: update tests for new @upgrade query

gopherbot pushed a commit that referenced this issue Jul 3, 2019
This should have been part of CL 184440.

Updates #32846

Change-Id: I78a1326f4a67b3b526859bd15cb9653b4a8551a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/184920
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.