diff --git a/pkg/backy/backy.go b/pkg/backy/backy.go index 72aefd2..8f22496 100644 --- a/pkg/backy/backy.go +++ b/pkg/backy/backy.go @@ -59,12 +59,12 @@ func (command Command) runCmd() logging.Logging { remoteHost.Port = 22 remoteHost.Host = command.RemoteHost.Host - sshConnection, err := remoteHost.ConnectToSSHHost() + sshClient, err := remoteHost.ConnectToSSHHost() if err != nil { panic(fmt.Errorf("ssh dial: %w", err)) } - defer sshConnection.Close() - s, err := sshConnection.NewSession() + defer sshClient.Close() + s, err := sshClient.NewSession() if err != nil { panic(fmt.Errorf("new ssh session: %w", err)) } diff --git a/pkg/backy/ssh.go b/pkg/backy/ssh.go index b82948c..4984b08 100644 --- a/pkg/backy/ssh.go +++ b/pkg/backy/ssh.go @@ -51,7 +51,7 @@ func (config SshConfig) GetSSHConfig() (SshConfig, error) { func (remoteConfig *Host) ConnectToSSHHost() (*ssh.Client, error) { - var sshConnection *ssh.Client + var sshClient *ssh.Client var connectErr error f, _ := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "config")) @@ -104,7 +104,7 @@ func (remoteConfig *Host) ConnectToSSHHost() (*ssh.Client, error) { HostKeyCallback: ssh.InsecureIgnoreHostKey(), } for _, host := range remoteConfig.HostName { - sshConnection, connectErr = ssh.Dial("tcp", host, sshConfig) + sshClient, connectErr = ssh.Dial("tcp", host, sshConfig) if connectErr != nil { panic(fmt.Errorf("error when connecting to host %s: %w", host, connectErr)) } @@ -113,5 +113,5 @@ func (remoteConfig *Host) ConnectToSSHHost() (*ssh.Client, error) { } } - return sshConnection, connectErr + return sshClient, connectErr }