Skip to content

Commit 56a6854

Browse files
Briakernicklasfrahm
authored andcommitted
Fixed variable initialization issue
1 parent 2089d4d commit 56a6854

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

main.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,17 @@ func Copy(client *ssh.Client) {
171171
func ConfigureAuthentication(key string, passphrase string, password string) []ssh.AuthMethod {
172172
// Create signer for public key authentication method.
173173
auth := make([]ssh.AuthMethod, 1)
174+
174175
if key != "" {
176+
var err error
177+
var targetSigner ssh.Signer
178+
175179
if passphrase != "" {
176-
targetSigner, err := ssh.ParsePrivateKeyWithPassphrase([]byte(key), []byte(passphrase))
180+
targetSigner, err = ssh.ParsePrivateKeyWithPassphrase([]byte(key), []byte(passphrase))
177181
} else {
178-
targetSigner, err := ssh.ParsePrivateKey([]byte(key))
182+
targetSigner, err = ssh.ParsePrivateKey([]byte(key))
179183
}
184+
180185
if err != nil {
181186
log.Fatalf("❌ Failed to parse private key: %v", err)
182187
}

0 commit comments

Comments
 (0)