-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: should 'go get -m -u' only consider dependencies of the main module? #32038
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
Comments
I discussed this with @rsc earlier today.
Since the |
Yes, let's remove -m. Any uses that want to avoid the build should now use -d (like pre-modules). |
Milestone here was set to 1.14, but then a day or so later |
@thepudds Good catch. Now planned for 1.13. |
Change https://golang.org/cl/177879 mentions this issue: |
Change https://golang.org/cl/179361 mentions this issue: |
In #32038, it was decided to remove get's -m, since one former use case is removed, and the other can be done via -d, as pointed by Russ. However, a user getting this short error might not realise that they can switch to -d to skip building packages. Add a short mention to point them in the right direction. It's important to note "packages", because -m was a flag that acted on modules, while -d acts on packages. Simply replacing -m with -d might not be enough in some cases because of that distinction. Change-Id: I0947b25c4223bdad3cd0e535848527da8db8a16d Reviewed-on: https://go-review.googlesource.com/c/go/+/179361 Reviewed-by: Jay Conrod <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]> Run-TryBot: Daniel Martí <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
Since CL 174099,
go get -m -u A
upgrades module A to the latest version, as well as modules providing packages transitively imported by packages in A. This may introduce requirements on modules not needed to build packages in the main module, i.e., requirements that would be removed bygo mod tidy
.For example, suppose that:
go get -m -u A
will upgrade both A and B to the latest version, probably introducing a requirement on B in go.mod.@bcmills suggested that we tweak the meaning of
go get -m -u A
a little bit. The-m
flag causes us to expandA
to the set of packages provided by moduleA
. For the purpose of-u
, we could intersect that set withall
, giving us the set of packages provided by moduleA
needed to build packages in the main module.With this change,
go get -m -u A
in the example above would update A but not B, since the argumentA
would expand to the packageA/x
but notA/y
.@rsc Any thoughts? @bcmills and I discussed this for a while this morning, but we didn't reach a conclusion. It seems like a useful change, but it adds some complexity.
The text was updated successfully, but these errors were encountered: