cmd/go: go get -u on a single module results in indirect modules being updated too #28156
Labels
FrozenDueToAge
modules
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What did you do?
I have a project that uses go modules. It includes in it an indirect dependency on
golang.org/x/tools
. I have a second project that uses the first project. It has a direct dependency ongolang.org/x/tools
.I run
go get -u <first module>
and it updates both the module I specify andgolang.org/x/tools
even though the first module has not updated its dependency.It can be seen in the commits for the project here: https://github.com/jsternberg/go-get-update
Inside of that repository, the output of
go mod graph
is included at each step.What did you expect to see?
I did not expect to see
golang.org/x/tools
updated. I only expectedgithub.com/influxdata/flux
to be on the updated list or, if tools was updated, to be updated to the version in flux rather than the latest.What did you see instead?
The
golang.org/x/tools
project always becomes the latest. This is most noticeable withgolang.org/x/tools
because it is actively being worked on, but I have noticed this with other implicit dependencies.At the moment, I think it's only with this very specific relationship where a dependency is not a module and it is included implicitly in a module and included explicitly in a third module. We've experienced some weird update behaviors and are unsure about which ones are bugs and which ones are us learning modules. I think this one is a bug based on my current understanding of modules though.
When updating, I also see this output which is strange considering that only a single module is being updated:
System details
The text was updated successfully, but these errors were encountered: