code: func (u *Endpoint) String() string {
  	var buf bytes.Buffer
  	if u.Protocol != "" {
  		buf.WriteString(u.Protocol)
  		buf.WriteByte(':')
  	}
  
  	if u.Protocol != "" || u.Host != "" || u.User != "" || u.Password != "" {
  		buf.WriteString("//")
  
  		if u.User != "" || u.Password != "" {
  			buf.WriteString(url.PathEscape(u.User))
  			if u.Password != "" {
  				buf.WriteByte(':')
  				buf.WriteString(url.PathEscape(u.Password))
  			}
  
  			buf.WriteByte('@')
  		}
  
  		if u.Host != "" {
  			buf.WriteString(u.Host)
  
  			if u.Port != 0 {
  				port, ok := defaultPorts[strings.ToLower(u.Protocol)]
  				if !ok || ok && port != u.Port {
  					fmt.Fprintf(&buf, ":%d", u.Port)
  				}
  			}
  		}
  	}
  
  	if u.Path != "" && u.Path[0] != '/' && u.Host != "" {
  		buf.WriteByte('/')
  	}
  
  	buf.WriteString(u.Path)
  	return buf.String()
  }
docs: // String returns a string representation of the Git URL.