code: func hasPort(s string) bool {
  	// IPv6 address in brackets.
  	if strings.LastIndex(s, "[") == 0 {
  		return strings.LastIndex(s, ":") > strings.LastIndex(s, "]")
  	}
  
  	// Otherwise the presence of a single colon determines if there's a port
  	// since IPv6 addresses outside of brackets (count > 1) can't have a
  	// port.
  	return strings.Count(s, ":") == 1
  }
docs: // hasPort is given a string of the form "host", "host:port", "ipv6::address",
  // or "[ipv6::address]:port", and returns true if the string includes a port.