code: func ensurePort(s string, port int) string {
  	if hasPort(s) {
  		return s
  	}
  
  	// If this is an IPv6 address, the join call will add another set of
  	// brackets, so we have to trim before we add the default port.
  	s = strings.Trim(s, "[]")
  	s = net.JoinHostPort(s, strconv.Itoa(port))
  	return s
  }
docs: // ensurePort makes sure the given string has a port number on it, otherwise it
  // appends the given port as a default.