func ValidateGitCloneURL(url string) error {
	exampleURL := "https://github.com/org/foo.git"
	if url == "" {
		return fmt.Errorf("clone URL is missing (example clone URL %v)", exampleURL)
	}
	// Use the git client's validator to make sure its a valid URL
	o := &git.CloneOptions{
		URL: url,
	}
	if err := o.Validate(); err != nil {
		return err
	}

	// Make sure its the type that we want. Of the following we
	// only accept the 'clone' type of url:
	//     git_url: "git://github.com/sjezewski/testgithook.git",
	//     ssh_url: "git@github.com:sjezewski/testgithook.git",
	//     clone_url: "https://github.com/sjezewski/testgithook.git",
	//     svn_url: "https://github.com/sjezewski/testgithook",
	invalidErr := fmt.Errorf("clone URL is missing .git suffix (example clone URL %v)", exampleURL)

	if !strings.HasSuffix(url, ".git") {
		// svn_url case
		return invalidErr
	}
	if !strings.HasPrefix(url, "https://") {
		// git_url or ssh_url cases
		return invalidErr
	}

	return nil
}
func ValidateGitCloneURL(url string) error {
	exampleURL := "https://github.com/org/foo.git"
	if url == "" {
		return fmt.Errorf("clone URL is missing (example clone URL %v)", exampleURL)
	}
	// Use the git client's validator to make sure its a valid URL
	o := &git.CloneOptions{
		URL: url,
	}
	if err := o.Validate(); err != nil {
		return err
	}

	// Make sure its the type that we want. Of the following we
	// only accept the 'clone' type of url:
	//     git_url: "git://github.com/sjezewski/testgithook.git",
	//     ssh_url: "git@github.com:sjezewski/testgithook.git",
	//     clone_url: "https://github.com/sjezewski/testgithook.git",
	//     svn_url: "https://github.com/sjezewski/testgithook",
	invalidErr := fmt.Errorf("clone URL is missing .git suffix (example clone URL %v)", exampleURL)

	if !strings.HasSuffix(url, ".git") {
		// svn_url case
		return invalidErr
	}
	if !strings.HasPrefix(url, "https://") {
		// git_url or ssh_url cases
		return invalidErr
	}

	return nil
}
// ValidateGitCloneURL returns an error if the provided URL is invalid