Skip to content

cmd/go: for v0 dependencies, consider changing 'go get -u[=patch]' behavior, or otherwise improve related behavior #28396

@thepudds

Description

@thepudds

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 and go 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 and go 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 and go 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:

  1. keep go get -u behavior as it currently defined for 1.11 modules, but redefine go get -u=patch to not upgrade any v0 dependencies.

  2. keep go get -u and go get -u=patch behavior as they are currently defined for 1.11 modules, but introduce a more conservative go get -u=somenewflag that upgrades all v1+ dependencies while leaving v0 dependencies alone.

  3. introduce a go get -u=all that is the current and more aggressive go get -u 1.11 modules behavior, and redefine go get -u and go 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 the require 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 from v0.0.0-20140202185014-0b12d6b521d8 to v0.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 include go 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, leftover go 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 remove go get -u instructions (if that is what ends up being needed).

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions