code: func HostnameFromAddr(addr string) (string, error) {
  	p, err := url.Parse(addr)
  	if err != nil {
  		return "", err
  	}
  	h := p.Host
  
  	// copied from https://golang.org/src/net/http/transport.go
  	if hasPort(h) {
  		h = h[:strings.LastIndex(h, ":")]
  	}
  
  	return h, nil
  }
docs: // HostnameFromAddr determines the hostname in an address string