-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Description
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 by go mod tidy
.
For example, suppose that:
- Module A has packages A/x and A/y.
- A/y imports B/z in module B.
- Packages in the main module import A/x, but not A/y or anything else that transitively imports B.
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 expand A
to the set of packages provided by module A
. For the purpose of -u
, we could intersect that set with all
, giving us the set of packages provided by module A
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 argument A
would expand to the package A/x
but not A/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.