Found in net/http/server.go:
type Server struct {
Addr string // TCP address to listen on, ":http" if empty
What is this ":http" exactly? Presumably an alias, but I can't find any concrete documentation to know what it resolves to.
https://golang.org/pkg/net/#Listen references
https://golang.org/pkg/net/#Dial which says "The port must be a literal port number or a service name."
Perhaps we should mention that comes from /etc/services (or equivalent, depending on OS).
@bradfitz How about mention that service name is defined in RFC 6335, and assigned by IANA
For each OS:
Document each OS seems too much details.
Is there missing a description of the address format in general? -- Empty host or port, port "0", square brackets for ipv6 addresses, ... As a reader of the comment I would also be interested in what does using the service name effectively means -- will it be port 80 or a dynamically assigned port from the 80** range?
Can we do something like this?
type Server struct {
// TCP address to listen on, ":http" (all IP addresses,
// default http port) if empty
// See package net for description of the address format
Addr string
As this issue has been inactive for a while, I'll submit a PR following @luka-zitnik suggestion.
Change https://golang.org/cl/191557 mentions this issue: net/http: enhance documentation for Server.Addr
Most helpful comment
@bradfitz How about mention that service name is defined in RFC 6335, and assigned by IANA
For each OS:
Document each OS seems too much details.