aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-09-24 13:59:30 +0700
committerShulhan <ms@kilabit.info>2023-09-24 13:59:30 +0700
commit737ec1762f44322b0a45ee2ba9800b9ba8aad77b (patch)
treeb123403a25c67e6fe1970a4162a36aff89ce4af1 /lib/ssh
parent77c41ce992e6295a6cd78eb75344adb8153ccb41 (diff)
downloadpakakeh.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.go8
-rw-r--r--lib/ssh/sftp/client_test.go4
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)
}