From a091cd4952e0d7fcd93f3e7059ab203546bb631e Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sat, 14 Feb 2026 16:04:18 -0500 Subject: [PATCH] Address JetBrains warnings --- crypt/rcw.go | 2 +- privkey/all.go | 3 +-- syncclient/client.go | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crypt/rcw.go b/crypt/rcw.go index a99ab6f..cb85709 100644 --- a/crypt/rcw.go +++ b/crypt/rcw.go @@ -21,7 +21,7 @@ func RCWDArgument() { if password == nil { os.Exit(0) // use os.Exit directly since this function is only intended for non-interactive CLI clients } - daemon.Start([]byte(password)) + daemon.Start(password) } // DecryptFileToSlice decrypts an RCW wrapped file diff --git a/privkey/all.go b/privkey/all.go index b8bf981..781f309 100644 --- a/privkey/all.go +++ b/privkey/all.go @@ -12,9 +12,8 @@ var keyBytesProvider = func(sshKeyPath *string) ([]byte, error) { return nil, errors.New("unable to read private key: " + *sshKeyPath) } return key, nil - } else { - return nil, errors.New("unable to identify private key location (nil config)") } + return nil, errors.New("unable to identify private key location (nil config)") } // GetBytes returns the SSH private key bytes. diff --git a/syncclient/client.go b/syncclient/client.go index d188ce3..31e2fcd 100644 --- a/syncclient/client.go +++ b/syncclient/client.go @@ -201,6 +201,7 @@ func sftpSync(sshClient *ssh.Client, sshEntryRoot, sshAgeDir string, sshIsWindow // download the file _, err = remoteFile.WriteTo(localFile) if err != nil { + _ = localFile.Close() return errors.New("unable to download remote file: " + err.Error()) } @@ -266,12 +267,15 @@ func sftpSync(sshClient *ssh.Client, sshEntryRoot, sshAgeDir string, sshIsWindow var remoteFile *sftp.File remoteFile, err = sftpClient.OpenFile(remoteFileRealPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY) if err != nil { + _ = localFile.Close() return errors.New("unable to create remote file: " + err.Error()) } // upload the file _, err = localFile.WriteTo(remoteFile) if err != nil { + _ = localFile.Close() + _ = remoteFile.Close() return errors.New("unable to upload local file: " + err.Error()) }