-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: mod init reject module names ending in /v0 and /v1 #44052
Comments
Please also include /v0 in this list |
I'll take a stab if there's no objection; I'll try to find a way which minimizes the changes needed to Do you think there's any other 'special' rules we should take care of, or just disallow the |
The rules are https://golang.org/ref/mod#go-mod-file-ident It currently also doesn't reject leading or trailing |
Let's limit a fix to just the major version suffix. There are lots of local modules that just have a single element path or don't have a dot in the first element. These modules can't be fetched normally, but they can appear on the left side of a Technically, we could say this is working as intended, but that seems user hostile. Someone who names their module |
Change https://golang.org/cl/288712 mentions this issue: |
I've opened a CL which utilizes One more point, and I'm not sure I'm reading this correctly is that the 'Module paths and versions' documentation could be improved. Right now, I think it's a little contradicting on whether dots are allowed in
|
@tpaschalis Why gopkg.in is in the CL? |
@seankhliao Are negative numbers allowed? |
Hello @inet56, thanks for reaching out. The documentation defines the valid major version suffixes, for gopkg.in and non-gopkg.in module paths. These checks are implemented in modules.SplitPathVersion. The CL provides a helpful error message for both cases. Do you think it makes sense? Also, I don't think that a negative version would make sense in a versioning system. |
Why is gopkg.in treated specially? |
What will happen if someone run
|
I think the reason why gopkg.in is treated in a special way is mainly compatibility. The major version suffixes and the import compatibility rule were already in place at gopkg.in before Go modules came along. I feel this goes well in hand with Go's compatibility promise, and not breaking users' workflow. Regarding the My 2c from the docs and gut feeling that |
What version of Go are you using (
go version
)?What did you do?
What did you expect to see?
A descriptive error saying
v0
or/v1
isn't allowed, ex withgorelease
:What did you see instead?
go.mod
created without errorThe text was updated successfully, but these errors were encountered: