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/url: parsing "localhost:8080" results in a url.URL with schema "localhost" #12585

Closed
nodirt opened this issue Sep 11, 2015 · 1 comment
Closed

Comments

@nodirt
Copy link
Contributor

nodirt commented Sep 11, 2015

http://play.golang.org/p/9zinaw70z8

u, err := url.Parse("localhost:8080")

here u is &url.URL{Scheme:"localhost", Opaque:"8080"}
should be &url.URL{Host:"localhost:8080"}

Will fix.

@bradfitz
Copy link
Contributor

Not a bug. url.Parse parses URLs. That's not a URL. A URL starts with a scheme.

If you want to split a host and a port there is http://golang.org/pkg/net/#SplitHostPort

@golang golang locked and limited conversation to collaborators Sep 22, 2016
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

3 participants