setup.go
func parseURL(repoURL string, private bool) (*url.URL, error) {
	// scheme
	urlParts := strings.Split(repoURL, "://")
	switch {
	case strings.HasPrefix(repoURL, "https://"):
	case strings.HasPrefix(repoURL, "http://"):
	case strings.HasPrefix(repoURL, "ssh://"):
	case len(urlParts) > 1:
		return nil, fmt.Errorf("Invalid url scheme %s. If url contains port, scheme is required", urlParts[0])
	default:
		if private {
			repoURL = "ssh://" + repoURL
		} else {
			repoURL = "https://" + repoURL
		}
	}

	u, err := url.Parse(repoURL)
	if err != nil {
		return nil, err
	}
	return u, nil
}
func parseURL(repoURL string, private bool) (*url.URL, error) {
	// scheme
	urlParts := strings.Split(repoURL, "://")
	switch {
	case strings.HasPrefix(repoURL, "https://"):
	case strings.HasPrefix(repoURL, "http://"):
	case strings.HasPrefix(repoURL, "ssh://"):
	case len(urlParts) > 1:
		return nil, fmt.Errorf("Invalid url scheme %s. If url contains port, scheme is required", urlParts[0])
	default:
		if private {
			repoURL = "ssh://" + repoURL
		} else {
			repoURL = "https://" + repoURL
		}
	}

	u, err := url.Parse(repoURL)
	if err != nil {
		return nil, err
	}
	return u, nil
}
func parseURL ( repoURL string , private bool ) ( * url . URL , error ) { // scheme urlParts := strings . Split ( repoURL , " " ) switch { case strings . HasPrefix ( repoURL , " " ) : case strings . HasPrefix ( repoURL , " " ) : case strings . HasPrefix ( repoURL , " " ) : case len ( urlParts ) > 1 : return nil , fmt . Errorf ( " " , urlParts [ 0 ] ) default : if private { repoURL = " " + repoURL } else { repoURL = " " + repoURL } } u , err := url . Parse ( repoURL ) if err != nil { return nil , err } return u , nil }
// parseURL validates if repoUrl is a valid git url.
parseURL validates if repoUrl is a valid git url .