Description
As noted in #27858 (comment), when a package is moved between two modules that share one of the complete module paths as a prefix, each needs to require
some baseline version of the other, for two reasons:
-
To ensure that
go get -u
doesn't drop any needed packages. -
To ensure that any third module that depends on both of the common-prefix modules will always end up in a configuration that provides only one copy of each package.
It would be really unfortunate if moving a package meant that you could never run go mod tidy
the involved modules again, or that you have to apply some manual edit every time you run it.
We should either modify go mod tidy
to avoid dropping requirements that are involved in a cycle with the main module, or add some explicit annotation comment to tell it not to drop an apparently-unnecessary requirement.