From a8cc62009f4c594ffe35b3a9a5f13eb1c0f40fb1 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 30 Jan 2017 00:45:46 +0800 Subject: [PATCH] refactor: update ssh host using JoinHostPort --- easyssh/easyssh.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/easyssh/easyssh.go b/easyssh/easyssh.go index 1496a5a..a031b47 100644 --- a/easyssh/easyssh.go +++ b/easyssh/easyssh.go @@ -9,6 +9,7 @@ import ( "fmt" "io" "io/ioutil" + "net" "os" "path/filepath" "time" @@ -76,7 +77,7 @@ func (ssh_conf *MakeConfig) connect() (*ssh.Session, error) { Auth: auths, } - client, err := ssh.Dial("tcp", ssh_conf.Server+":"+ssh_conf.Port, config) + client, err := ssh.Dial("tcp", net.JoinHostPort(ssh_conf.Server, ssh_conf.Port), config) if err != nil { return nil, err }