-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: for v0 dependencies, consider changing 'go get -u[=patch]' behavior, or otherwise improve related behavior #28396
Comments
This issue is more about the general concern, but at this point I have seen multiple problems with modules where someone followed older instructions saying One concrete example was that if you opted in to modules, and then followed the installation instructions for
I first saw this example with v1.15.21 of aws-sdk-go, which did have a https://github.com/aws/aws-sdk-go/blob/v1.15.21/go.mod
The That particular instance of this problem was diagnosed and then worked around (by not using |
We certainly should not change |
As you note, the possibility of breaking changes with At any rate, it's not at all clear to me why the folks maintaining |
Thanks @bcmills this was an oversight, the instructions on |
@jasdel could you comment briefly on the prior instructions that used |
Since the library used a vendor directory the usage of the update flag did not impact users getting the library using Go 1.10 and earlier since the dependencies were vendored. This behavior changed when a module file (go.mod) is defined with Go 1.11's module support enabled. The update flag does get the latest dependencies, ignoring the content of the vendor folder. I've updated the library's instructions. Also @thepudds would you mind opening up a GitHub issue with |
Updates the SDK's README.md to clarify the instructions for getting the SDK. This also avoids the potential issues getting the SDK with Go modules and retrieving a non-working version of SDK dependencies. Related to golang/go#28396
Updates the SDK's README.md to clarify the instructions for getting the SDK. This also avoids the potential issues getting the SDK with Go modules and retrieving a non-working version of SDK dependencies. Related to golang/go#28396
Even if there are breaking changes within Note that the |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.11.1 windows/amd64
Background
The current 1.11 behavior for
go get -u
andgo get -u=patch
is nice overall, and the ability to easily upgrade to the latest available dependencies is a nice counterbalance to default MVS behavior for indirect dependencies (where it tends to select older versions for indirect dependencies compared to a more traditional approach).However, the current behavior for
go get -u
andgo get -u=patch
works best when the dependencies are v1 or higher, and there is some danger when some dependencies are instead in the v0 "compatibility free zone". This is especially true for any indirect v0 dependencies (given the author of the current top-level module has less visibility/insight into indirect dependencies).Suggestion
Consider changing the default behavior of
go get -u
andgo get -u=patch
to work better with v0 dependencies.I am not necessarily trying to suggest a specific solution, but for illustration purposes, some alternative approaches might be:
keep
go get -u
behavior as it currently defined for 1.11 modules, but redefinego get -u=patch
to not upgrade any v0 dependencies.keep
go get -u
andgo get -u=patch
behavior as they are currently defined for 1.11 modules, but introduce a more conservativego get -u=somenewflag
that upgrades all v1+ dependencies while leaving v0 dependencies alone.introduce a
go get -u=all
that is the current and more aggressivego get -u
1.11 modules behavior, and redefinego get -u
andgo get -u=patch
to not upgrade any v0 dependencies(And for any of the alternatives that "leave v0 dependencies alone" but upgrade v1+ dependencies, one of those upgraded v1+ dependencies might include a
require
that then triggers a v0 upgrade. Presumably that would be allowed, but therequire
would be a strong hint that that particular v0 version was at least tested by one or more v1+ dependency).If #28395 or similar is adopted, then that would likely play into what the desired behavior here would be (e.g., alternative 2 might be more appealing in that case).
I suspect most of the comments here apply to both normal v0 versions (such as
v0.1.0
) as well as v0 pseudo-versions, though something like an upgrade fromv0.0.0-20140202185014-0b12d6b521d8
tov0.0.0-20180823135443-60711f1a8329
does not have a concept of a patch vs. non-patch upgrade.Finally, a related issue is that many pre-existing repos include instructions that state the user should do
go get -u foo
. A quick and unscientific survey shows that 3 of the first 5 packages listed under "Popular Packages" on https://godoc.org currently includego get -u foo
instructions. Some of those existing instructions likely assume pre-modules vendoring behavior or otherwise rely on pre-module behavior. In a module world, leftovergo get -u foo
instructions are somewhat dangerous if there are v0 dependencies, but it might take some time for pre-existing repos to alter or removego get -u
instructions (if that is what ends up being needed).The text was updated successfully, but these errors were encountered: