diff options
| author | Shulhan <ms@kilabit.info> | 2023-09-24 13:59:30 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-09-24 13:59:30 +0700 |
| commit | 737ec1762f44322b0a45ee2ba9800b9ba8aad77b (patch) | |
| tree | b123403a25c67e6fe1970a4162a36aff89ce4af1 /lib/ssh | |
| parent | 77c41ce992e6295a6cd78eb75344adb8153ccb41 (diff) | |
| download | pakakeh.go-737ec1762f44322b0a45ee2ba9800b9ba8aad77b.tar.xz | |
ssh/sftp: rename method Close to CloseFile
Since the method accept FileHandle, that is returned from OpenFIle,
then the method should changes with the same suffix.
This is also to make the method ambigous later when we add Close method
to close clinet connection.
Diffstat (limited to 'lib/ssh')
| -rw-r--r-- | lib/ssh/sftp/client.go | 8 | ||||
| -rw-r--r-- | lib/ssh/sftp/client_test.go | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/ssh/sftp/client.go b/lib/ssh/sftp/client.go index c7e0ba2b..e6462ce3 100644 --- a/lib/ssh/sftp/client.go +++ b/lib/ssh/sftp/client.go @@ -79,8 +79,8 @@ func NewClient(sshc *ssh.Client) (cl *Client, err error) { return cl, nil } -// Close the remote file handle. -func (cl *Client) Close(fh *FileHandle) (err error) { +// CloseFile close the remote file handle. +func (cl *Client) CloseFile(fh *FileHandle) (err error) { if fh == nil { return nil } @@ -203,7 +203,7 @@ func (cl *Client) Get(remoteFile, localFile string) (err error) { return fmt.Errorf("%s: %w", logp, err) } - err = cl.Close(fin) + err = cl.CloseFile(fin) if err != nil { return fmt.Errorf("%s: %w", logp, err) } @@ -362,7 +362,7 @@ func (cl *Client) Put(localFile, remoteFile string) (err error) { return fmt.Errorf("%s: %w", logp, err) } - err = cl.Close(fout) + err = cl.CloseFile(fout) if err != nil { return fmt.Errorf("%s: %w", logp, err) } diff --git a/lib/ssh/sftp/client_test.go b/lib/ssh/sftp/client_test.go index 79d1d4e7..dd235cff 100644 --- a/lib/ssh/sftp/client_test.go +++ b/lib/ssh/sftp/client_test.go @@ -175,7 +175,7 @@ func TestClient_Rename(t *testing.T) { t.Fatal(err) } - err = testClient.Close(fh) + err = testClient.CloseFile(fh) if err != nil { t.Fatal(err) } @@ -265,7 +265,7 @@ func TestClient_Symlink(t *testing.T) { if err != nil { t.Fatal(err) } - err = testClient.Close(fh) + err = testClient.CloseFile(fh) if err != nil { t.Fatal(err) } |
