From cfa11e851a432471b4816a3765dd0cf20d7717af Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Fri, 10 Nov 2017 00:23:40 -0600 Subject: [PATCH] [easyssh] make connect method as public. (appleboy/easyssh-proxy#36) * make connect method as public. Signed-off-by: Bo-Yi Wu * fix go path. Signed-off-by: Bo-Yi Wu * fix golint error. Signed-off-by: Bo-Yi Wu https://github.com/appleboy/drone-ssh/commit/ca8e8301291 --- .../appleboy/easyssh-proxy/easyssh.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/vendor/github.com/appleboy/easyssh-proxy/easyssh.go b/vendor/github.com/appleboy/easyssh-proxy/easyssh.go index 879e951..1295498 100644 --- a/vendor/github.com/appleboy/easyssh-proxy/easyssh.go +++ b/vendor/github.com/appleboy/easyssh-proxy/easyssh.go @@ -104,8 +104,8 @@ func getSSHConfig(config DefaultConfig) *ssh.ClientConfig { } } -// connect to remote server using MakeConfig struct and returns *ssh.Session -func (ssh_conf *MakeConfig) connect() (*ssh.Session, error) { +// Connect to remote server using MakeConfig struct and returns *ssh.Session +func (ssh_conf *MakeConfig) Connect() (*ssh.Session, error) { var client *ssh.Client var err error @@ -168,13 +168,13 @@ func (ssh_conf *MakeConfig) Stream(command string, timeout int) (<-chan string, doneChan := make(chan bool) errChan := make(chan error) - // connect to remote host - session, err := ssh_conf.connect() + // Connect to remote host + session, err := ssh_conf.Connect() if err != nil { return stdoutChan, stderrChan, doneChan, errChan, err } // defer session.Close() - // connect to both outputs (they are of type io.Reader) + // Connect to both outputs (they are of type io.Reader) outReader, err := session.StdoutPipe() if err != nil { return stdoutChan, stderrChan, doneChan, errChan, err @@ -258,7 +258,7 @@ loop: // Scp uploads sourceFile to remote machine like native scp console app. func (ssh_conf *MakeConfig) Scp(sourceFile string, etargetFile string) error { - session, err := ssh_conf.connect() + session, err := ssh_conf.Connect() if err != nil { return err @@ -297,9 +297,5 @@ func (ssh_conf *MakeConfig) Scp(sourceFile string, etargetFile string) error { } }() - if err := session.Run(fmt.Sprintf("scp -tr %s", etargetFile)); err != nil { - return err - } - - return nil + return session.Run(fmt.Sprintf("scp -tr %s", etargetFile)) }