|author||Bryan C. Mills <email@example.com>||Mon Feb 22 12:50:38 2021 -0500|
|committer||Bryan C. Mills <firstname.lastname@example.org>||Tue Feb 23 20:29:49 2021 +0000|
modfile: check canonicalness against the relevant module path, not abstract semver In CL 279394 we started validating that versions in "exclude" and "retract" directives are canonical. Unfortunately, we use the semver package's notion of canonicalness, and the semver package doesn't know anything about +incompatible versions or major-version suffixes. The resulting error messages also don't indicate an appropriate fix if the problem is that the user forgot either the "+incompatible" suffix on the version string or the "/vN" suffix on the module path. This change corrects both of those problems by validating the version against the corresponding module path. (For "exclude" directives, that is the module path to be excluded; for "retract" directives, it is the module declared in the "module" directive of the same go.mod file.) For golang/go#44497 Change-Id: I39732d79c3ab3a43bb1fb8905062fe6cb26d3edc Reviewed-on: https://go-review.googlesource.com/c/mod/+/295089 Trust: Bryan C. Mills <email@example.com> Reviewed-by: Jay Conrod <firstname.lastname@example.org> Reviewed-by: Michael Matloob <email@example.com>
This repository holds packages for writing tools that work directly with Go module mechanics. That is, it is for direct manipulation of Go modules themselves.
It is NOT about supporting general development tools that need to do things like load packages in module mode. That use case, where modules are incidental rather than the focus, should remain in x/tools, specifically x/tools/go/packages.
The specific case of loading packages should still be done by invoking the go command, which remains the single point of truth for package loading algorithms.