anko
                                
                                
                                
                                    anko copied to clipboard
                            
                            
                            
                        SSH library
I wonder if it possible to add ssh library. Currently making ssh connection and run remote command is too much boilerplate in Go - https://gist.github.com/erikdubbelboer/f62a109d8e8798a11eb89ed494491953.
If we can simplify this in anko, it can be a practical alternative for some scripting work in Go (anko).
I try to add the ssh and ssh/agent library - https://github.com/k4ml/anko/commit/9f646360ab6152dc6490f192af8687638d6dde05
Now I'm stuck with this error on go build:-
# github.com/mattn/anko/builtins/ssh
builtins/ssh/ssh.go:13: cannot make type ssh.ClientConfig
I'm trying to make this anko script to work:-
var ssh, agent = import("ssh"), import("ssh/agent")
var ioutil, net, os = import("io/ioutil"), import("net"), import("os")
func privateKeyPath() {
    return os.Getenv("HOME") + "/.ssh/kamalkey.pem"
}
func parsePrivateKey(keyPath) {
    buff, _ = ioutil.ReadFile(keyPath)
    return ssh.ParsePrivateKey(buff)
}
func makeSshConfig(user) {
    socket = os.Getenv("SSH_AUTH_SOCK")
    conn, err = net.Dial("unix", socket)
    agentClient = agent.NewClient(conn)
    config = make(ssh.ClientConfig)
    config.Set("user", user)
    #config = make(ssh.ClientConfig{
    #    User: user,
    #    Auth: []ssh.AuthMethod{
    #        ssh.PublicKeysCallBack(agentClient.Signers),
    #    },
    #})
    return config, nil
}
func main() {
    config, err = makeSshConfig("kamal")
    client, err = ssh.Dial("tcp", "myserver:22", config)
}
main()
                                    
                                    
                                    
                                
please keep package namespaces as same as golang.
Do you think this can be closed?
@mattn any thoughts?