-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Description
What did you do?
https://go.dev/play/p/Lypv_o9VMRf
host := "fc00::121:0:2:27"
url := url.URL{
Scheme: "https",
Host: host,
Path: "/some/path",
}
fmt.Println(url.String())
What did you expect to see?
https://[fc00::121:0:2:27]/some/path
What did you see instead?
https://fc00::121:0:2:27/some/path
This ends up being interpreted as https://[fc00::121:0:2]:27/some/path.
The documentation for url.URL.Host is host or host:port, which leaves it unclear as to how a literal IPv6 address would be treated.
I think it makes more sense to treat a literal IPv6 address as just that, and require the user to specify [<ipv6-address>]:<port> if that's what they actually wanted, though I appreciate that there would be backward compatibility issues with that.
So at this point, it's probably best to just clarify the docs and add a reference to net.JoinHostPort. This could perhaps be done via #61093.
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.