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 get -u" fails to parse git URL #11457

Closed
cskr opened this issue Jun 29, 2015 · 11 comments
Closed

cmd/go: "go get -u" fails to parse git URL #11457

cskr opened this issue Jun 29, 2015 · 11 comments
Milestone

Comments

@cskr
Copy link

cskr commented Jun 29, 2015

With a git remote URL of the form ssh://git@my.company/package and a custom import path using HTML <meta>, go get my.company/package works, but go get -u my.company/package fails with the following error:

package my.company/package: unable to parse output of git config remote.origin.url

Changing the URL from ssh:// to git+ssh:// fixes it. Either ssh:// should be made to work or a list of supported schemes for each VCS should be documented somewhere.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jul 11, 2015
@jacobsa
Copy link
Contributor

jacobsa commented Jul 12, 2015

@ianlancetaylor: No chance of getting this fixed for Go 1.5? I'm fairly sure it worked in Go 1.4, and has been broken since then.

Note that GitHub uses ssh://; it doesn't require a custom import path. I used to be able to do this in order to update my personal repo and its dependencies:

go get -u -f github.com/jacobsa/gcloud/...

But this no longer works.

@jacobsa
Copy link
Contributor

jacobsa commented Jul 12, 2015

Oops, GitHub remotes actually look like:

git@github.com:jacobsa/gcloud.git

Still, I get the same error. I assume this is the same bug.

@adg adg modified the milestones: Go1.5Maybe, Go1.6 Jul 14, 2015
@adg
Copy link
Contributor

adg commented Jul 14, 2015

I think this is a regression from 1.4. We should fix it for 1.5 if we can easily do so.

@dmitris
Copy link
Contributor

dmitris commented Jul 14, 2015

I have a similar case - the tag includes a RepoRoot starting with ssh://git@git.corp.company.com path, and trying to do go get with 1.5 produces an error:

package go.corp.company.com/org/repo/...: cannot download, ssh://git@git.corp.company.com/org/repo uses insecure protocol

We could work around with -insecure flag to go get but I would really hate to train our developers to pass such options on a regular basis. The error seems wrong since ssh://git is a secure protocol.

Should we change the server sending the meta tags to send git+ssh://git@git.corp.company.com instead of the current ssh://git@git.corp.company.com? Would it solve the problem?

@gopherbot
Copy link

CL https://golang.org/cl/12226 mentions this issue.

@marcopeereboom
Copy link

https://golang.org/cl/12226 fixes the issue.

@adg adg closed this as completed in 5cd2944 Jul 15, 2015
@jacobsa
Copy link
Contributor

jacobsa commented Jul 15, 2015

@adg: Thanks! I confirm this fixes it for me. Given that this has already regressed once though, is it possible to add a test?

@adg
Copy link
Contributor

adg commented Jul 15, 2015

@jacobsa I thought about it. Hard to do it comprehensively.

One straightforward approach would be to test the gitRemoteRepo function by creating a git repo and setting its origin. At that point though you might as well split gitRemoteRepo into two parts, one of which just parses strings, and test the string parsing function.

Doing an integration test is hard because ssh is an unwieldy dependency in tests. In fact, we've stubbed it out for all the go tool's tests.

@jacobsa
Copy link
Contributor

jacobsa commented Jul 15, 2015

No worries, just wanted to make sure you had considered it. Back to the peanut gallery with me.

@bradfitz
Copy link
Contributor

@dalu, comments on closed bugs generally are ignored. If you found a new issue, you're probably best off reporting it on a new bug.

fsouza pushed a commit to fsouza/go that referenced this issue Feb 25, 2016
Now that we care about the protocol of Git remotes (for the -insecure
flag), we need to recognize and parse the SCP-like remote format.

Fixes golang/go#11457

Change-Id: Ia26132274fafb1cbfefe2475f7ac5f17ccd6da40
Reviewed-on: https://go-review.googlesource.com/12226
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/23447 mentions this issue.

gopherbot pushed a commit that referenced this issue May 27, 2016
This is a fixup change for commit 5cd2944
that added parsing of SCP-like addresses. To get the expected output
from (*url.URL).String(), Path needs to be set, not RawPath.

Add a test for this, since it has already regressed multiple times.

Updates #11457.

Change-Id: I806f5abbd3cf65e5bdcef01aab872caa8a5b8891
Reviewed-on: https://go-review.googlesource.com/23447
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
@golang golang locked and limited conversation to collaborators May 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants