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$
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: