Skip to content

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

@jawnsy

Description

@jawnsy

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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions