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: parseHost could share code with net/SplitHostPort #17077

Closed
jawnsy opened this issue Sep 12, 2016 · 1 comment
Closed

net/url: parseHost could share code with net/SplitHostPort #17077

jawnsy opened this issue Sep 12, 2016 · 1 comment

Comments

@jawnsy
Copy link

jawnsy commented Sep 12, 2016

It seems like the code for parsing hosts in net/url - the parseHost method:
https://github.com/golang/go/blob/master/src/net/url/url.go#L540

could invoke the net/SplitHostPort method instead:
https://github.com/golang/go/blob/master/src/net/ipsock.go#L109

Is the separate parseHost done for performance optimization reasons, or was this just an oversight? If the former, maybe the code would benefit from a comment explaining this (and referencing the other method).

@bradfitz
Copy link
Contributor

The net/url package doesn't depend on the net package. See comments in src/go/build/deps_test.go.

Doesn't seem worth refactoring into a third shared package to share code either.

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

3 participants