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

go get https://github.com/user/repo should work #30913

Closed
localhostdotdev opened this issue Mar 18, 2019 · 10 comments
Closed

go get https://github.com/user/repo should work #30913

localhostdotdev opened this issue Mar 18, 2019 · 10 comments

Comments

@localhostdotdev
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.12.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

macOS / amd64 (this applies to all platforms) (and I don't like giving out my local user name)

What did you do?

go get https://github.com/cloudflare/mitmengine

What did you expect to see?

Nothing, just having the dependency added.

What did you see instead?

An error:

package https:/github.com/cloudflare/mitmengine: https:/github.com/cloudflare/mitmengine: invalid import path: malformed import path "https:/github.com/cloudflare/mitmengine": invalid char ':'

I'm not sure what's the rationale behind this (it actually goes through the git protocol probably), but as an user I expect to be able to copy/paste from Chrome and have it work without removing the https:// everytime.

Thanks.

@mvdan
Copy link
Member

mvdan commented Mar 18, 2019

Please read go help packages - Go packages are defined by import paths, which do not include http nor https schemes.

@localhostdotdev
Copy link
Author

Yes, I'm not saying this isn't how it's meant to be working right now, I'm saying this is how I expect it to work as a new user of Go.

@dmitshur
Copy link
Contributor

Is there something in the go get documentation that made you think there should be an https:// prefix in front of the import path?

@localhostdotdev
Copy link
Author

localhostdotdev commented Mar 19, 2019

Anyway, I don't expect to change anyone's opinion, just pointing this out. Maybe you don't experience this, maybe you do. I think I'm far from the only person to expect https:// http:// git:// protocols to work when writing an url (even if in that case it represents an import path).

Also most people don't read the go help/man pages (which could be formatted better BTW), but google the issue they are having and/or follow a tutorial / classes. In my case I don't use go, just wanted to use a go-only library for a quick little project.

@dmitshur
Copy link
Contributor

Thanks for providing additional information and context. It's helpful to finding out if there's something we can do to make an improvement.

@localhostdotdev
Copy link
Author

I'm closing this as I don't think this is going to change and telling me to read the documentation is a bit disrespectful. To be honest that's exactly the reaction I expected.

@ianlancetaylor
Copy link
Contributor

I'm sorry that you feel that the replies here were disrespectful. I know that was not the intent.

Unfortunately it's not really possible to use a complex system like Go without reading any documentation. That is not a goal of ours.

@axemaster
Copy link

Agree with OP this should work.

@axemaster
Copy link

At a minimum go could suggest a corrected command

@rcontisplk
Copy link

Complex systems often use dependencies, and sometimes those dependencies are poorly or improperly documented.
I ran across this issue when fighting the exact same problem (due to poor documentation in a guide I was following), so clearly there are at least two of us, and probably many more. The fact that the error drops a forward slash makes one immediately think there's a typo, or a broken redirect, or an escaping issue. My first step was to crawl through Go files in our repository trying to figure out where the missing slash was in the codebase, and it took me at least 10-15 minutes to figure out what ended up being a very simple mistake.
Providing a useful error (rather than one that ends up being unintentionally misleading, through no fault of the Go maintainers) would involve a minimum level of effort and would be appreciated by many folks in the future who will run across this same problem.
It may not be a goal of yours that folks use Go without reading the documentation, but the fact of the matter is that users will do so, as mentioned in the case of the issue creator's tutorial. Usability can help or hinder adoption of a platform, so I think it's at least worth considering, though, like all of us, I'm sure you have many competing priorities. Thanks for hearing us out :)

@golang golang locked and limited conversation to collaborators Apr 14, 2021
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

7 participants