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

net: dial should not fail for legitimate urls that work in other languages e.g Redis URLs #20688

Closed
joelpresence opened this issue Jun 15, 2017 · 6 comments

Comments

@joelpresence
Copy link

Please answer these questions before submitting your issue. Thanks!

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

go version go1.8.1 darwin/amd64

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

darwin amd64

What did you do?

Go cannot connect to a valid url like redis://user:password@a1.a2.a3.ec2.cloud.redislabs.com:45678. This is a perfectly valid URL that conforms to the redis scheme and works just fine in other languages like Ruby. Go fails to connect to this using Dial with an error like "dial tcp: address redis://user:password@a1.a2.a3.ec2.cloud.redislabs.com:45678: too many colons in address which seems to come from ipsock.go.

Any suggestions as to how to fix go to connect to this URL? Or how I can fix the url so that go can dial connect to it? I have tried using [] all over the place to no avail.

Thanks! :-)

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

What did you see instead?

@odeke-em
Copy link
Member

@joelpresence here is how @garyburd connects to Redis in his project redigo https://github.com/garyburd/redigo/blob/master/redis/conn.go#L214-L266. He might have some input on this as well, if you please, @garyburd.

@odeke-em odeke-em changed the title Go should not fail parsing legitimate urls that work in other languages net: dial should not fail for legitimate urls that work in other languages e.g Redis URLs Jun 15, 2017
@odeke-em
Copy link
Member

/cc @bradfitz @mikioh

@vcabbage
Copy link
Member

The example URL parses fine with url.Parse().

net.Dial() doesn't accept URLs:

For TCP and UDP networks, addresses have the form host:port.

I'm going to go ahead an close this since it's not a bug.

@joelpresence
Copy link
Author

joelpresence commented Jun 15, 2017 via email

@bradfitz
Copy link
Contributor

For questions about Go, see https://golang.org/wiki/Questions.

@joelpresence
Copy link
Author

Fixed using DialURL. Thanks.

@golang golang locked and limited conversation to collaborators Jun 15, 2018
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

5 participants