Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: 'go mod edit' can add requirements that it can't remove #32630

bcmills opened this issue Jun 14, 2019 · 2 comments


Copy link

@bcmills bcmills commented Jun 14, 2019

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.$ gotip mod init
go: creating new go.mod: module$ gotip version
go version devel +9838f4df Fri Jun 14 18:41:07 2019 +0000 linux/amd64$ gotip mod edit -require$ gotip mod edit -droprequire
go: errors parsing go.mod:
/tmp/tmp.5UPKq2KvZc/ invalid module: should be v0 or v1, not v2 (v2.0.0)$ cat go.mod

go 1.13

require v2.0.0$

CC @jayconrod

See also #30513, #26454.

@bcmills bcmills added this to the Go1.14 milestone Jun 14, 2019

This comment has been minimized.

Copy link

@hyangah hyangah commented Jun 17, 2019

FYI #27060 asked to validate the added requirement but was closed as working as intended.


This comment has been minimized.

Copy link
Member Author

@bcmills bcmills commented Jun 17, 2019

Yeah, I think the fix for this should go in the other direction: we should move the major-version validation from modfile.Parse to some later step.

@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.