cmd/go: consistently defer module path checks (including major-version matching) until import or build-list resolution #31662
Labels
early-in-cycle
A change that should be done early in the 3 month dev cycle.
modules
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
At the moment, we validate that the major version through which a module was resolved matches the major-version suffix of the path declared in its
go.mod
file.However, we perform that validation only sporadically (#31428), the resulting failure message (if any) can be difficult to understand in context (#30499, #30636), and a mismatch — even one involving mismatched major-version components — isn't even obviously correct if the module is involved in a
replace
directive (#26904, #27171 (comment)).I suspect that we should simply not validate module paths at all when fetching a module, and instead do the validation consistently only at loading time (when we resolve explicit package imports).
At that point:
replace
usage, we might need to relax this to allow the module path to also match the path and version from which the source code was fetched, but ideally only if thego.mod
file specifiesgo 1.12
or earlier.require
d).go mod download
, we don't know how it is going to be used, and thus should not validate anything about its path.CC @rsc @jayconrod @heschik @hyangah @katiehockman @leitzler @tbpg
The text was updated successfully, but these errors were encountered: