-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: .git in module names is stripped when used as repo url #71635
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
Comments
This is working as designed. The .git suffix is special syntax that indicates that git should be used for what comes before it. It is not part of the repo name. See https://pkg.go.dev/cmd/go#hdr-Remote_import_paths. If you want to make an arbitrary path work, the best answer is to use an HTTPS page with a redirecting meta tag (also described in that doc section). Another option is to make your git server allow the .git to be dropped, as happens in this case. If you must express to the go command an instruction to access of accessing example.url/project.git using git, you should be able to use example.com/url/project.git.git as the module path. That's obviously not ideal, but it's what the rules require. We can't change the rules without potentially breaking all the existing uses of the .git name in modules. Most usage is in private modules that we can't see, so the effects are particularly difficult to quantify. It would certainly be a breaking change, so we're not going to do that. |
Change https://go.dev/cl/644095 mentions this issue: |
Change https://go.dev/cl/648475 mentions this issue: |
For #71635 Change-Id: I12ec2a810cfcaf2565b0d9c518b0921ec54e9f12 Reviewed-on: https://go-review.googlesource.com/c/go/+/648475 Reviewed-by: Michael Matloob <matloob@golang.org> Auto-Submit: Sam Thanawalla <samthanawalla@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Understood. |
The text says "up to" without including the vcs identifier, which matches current cmd/go behavior, but the example includes the vcs identifier in the url. For golang/go#71635 Change-Id: If8277b1305c496f3ba20e6c58f5f920cf1ba48a9 Reviewed-on: https://go-review.googlesource.com/c/website/+/644095 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
Go-get uses only a section of module path argument
What version of Go are you using (go version)?
master
What operating system and processor architecture are you using?
Any.
What did you do?
Run Go-get directly on a module path containing a
.git
suffix. For example:What did you expect to see?
The module path passed to the Go tool used in the
ls-remote
command and subsequent operations. E.g.:What did you see instead?
A section of the passed module path, without the
.git
suffix at the end:Investigation
This line[1] and this one[2] seem to be causing the issue. Such behavior assumes the
.git
suffix is not part of the module path, using the submatch instead of the string passed to the Go command.---
[1]:
go/src/cmd/go/internal/vcs/vcs.go
Line 1178 in 215de81
[2]:
go/src/cmd/go/internal/vcs/vcs.go
Line 1582 in 215de81
The text was updated successfully, but these errors were encountered: