You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go mod edit -require can be used to add versions that don't match the major version of the corresponding module.
Unfortunately, the major-version validation happens early during parsing, so go mod edit -droprequire cannot subsequently drop those requirements.
example.com$ gotip mod init example.com
go: creating new go.mod: module example.com
example.com$ gotip version
go version devel +9838f4df Fri Jun 14 18:41:07 2019 +0000 linux/amd64
example.com$ gotip mod edit -require golang.org/x/text@v2.0.0
example.com$ gotip mod edit -droprequire golang.org/x/text
go: errors parsing go.mod:
/tmp/tmp.5UPKq2KvZc/example.com/go.mod:5: invalid module: golang.org/x/text should be v0 or v1, not v2 (v2.0.0)
example.com$ cat go.mod
module example.com
go 1.13
require golang.org/x/text v2.0.0
example.com$
ParseLax is like Parse but ignores unknown statements
Where unknown statements would extend to incorrect or wrongly written known statements.
On tip, go mod edit is unusable on a go.mod if parsing returns an error, some examples are:
In the same way, go mod edit -print of go mod edit -json are also unusable when go.mod is erroneous.
The proposal is to return the parsed go.mod even when there is an error from ParseLax used with nil fix argument.
Returning the errors unfortunately fails make.bash.
The submitted CL illustrates the proposal. It requires to modify x/mod/modfile.
go mod edit -require
can be used to add versions that don't match the major version of the corresponding module.Unfortunately, the major-version validation happens early during parsing, so
go mod edit -droprequire
cannot subsequently drop those requirements.CC @jayconrod
See also #30513, #26454.
The text was updated successfully, but these errors were encountered: