func GenerateSSHKey(path string) error {
	if _, err := os.Stat(path); err != nil {
		if !os.IsNotExist(err) {
			return fmt.Errorf("Desired directory for SSH keys does not exist: %s", err)
		}

		kp, err := NewKeyPair()
		if err != nil {
			return fmt.Errorf("Error generating key pair: %s", err)
		}

		if err := kp.WriteToFile(path, fmt.Sprintf("%s.pub", path)); err != nil {
			return fmt.Errorf("Error writing keys to file(s): %s", err)
		}
	}

	return nil
}
func GenerateSSHKey(path string) error {
	if _, err := os.Stat(path); err != nil {
		if !os.IsNotExist(err) {
			return fmt.Errorf("Desired directory for SSH keys does not exist: %s", err)
		}

		kp, err := NewKeyPair()
		if err != nil {
			return fmt.Errorf("Error generating key pair: %s", err)
		}

		if err := kp.WriteToFile(path, fmt.Sprintf("%s.pub", path)); err != nil {
			return fmt.Errorf("Error writing keys to file(s): %s", err)
		}
	}

	return nil
}
func GenerateSSHKey ( path string ) error { if _ , err := os . Stat ( path ) ; err != nil { if ! os . IsNotExist ( err ) { return fmt . Errorf ( " " , err ) } kp , err := NewKeyPair ( ) if err != nil { return fmt . Errorf ( " " , err ) } if err := kp . WriteToFile ( path , fmt . Sprintf ( " " , path ) ) ; err != nil { return fmt . Errorf ( " " , err ) } } return nil }
// GenerateSSHKey generates SSH keypair based on path of the private key
// The public key would be generated to the same path with ".pub" added
GenerateSSHKey generates SSH keypair based on path of the private key The public key would be generated to the same path with . pub added