From bdf9a59cd7300287be8fa09203569cf2f674cfe8 Mon Sep 17 00:00:00 2001 From: QU35T-code Date: Sat, 27 Jan 2024 14:10:15 +0100 Subject: [PATCH] Fix lint --- lib/ssh/ssh.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ssh/ssh.go b/lib/ssh/ssh.go index 20d14aa..a265502 100644 --- a/lib/ssh/ssh.go +++ b/lib/ssh/ssh.go @@ -55,6 +55,9 @@ func GetUserFlag(connection *ssh.Client) (string, error) { } cmd := fmt.Sprintf("if [ -f %s ]; then echo found; else echo not found; fi", filePath) fileOutput, err := fileSession.CombinedOutput(cmd) + if err != nil { + return "", err + } fileSession.Close() if strings.TrimSpace(string(fileOutput)) == "found" { @@ -108,6 +111,9 @@ func GetHostname(connection *ssh.Client) (string, error) { } cmd := "hostname" sessionOutput, err := hostnameSession.CombinedOutput(cmd) + if err != nil { + return "", err + } hostnameSession.Close() hostname := strings.ReplaceAll(string(sessionOutput), "\n", "") config.GlobalConfig.Logger.Debug(fmt.Sprintf("Hotname: %s", hostname))