From 0130e6dd1b612aa81a5d5a4f34960575516386fc Mon Sep 17 00:00:00 2001 From: windvalley Date: Fri, 12 Jan 2024 17:40:32 +0800 Subject: [PATCH] refactor(fetch): delete useless code --- pkg/batchssh/fetch.go | 6 ------ pkg/batchssh/fetch_zip.go | 6 ------ 2 files changed, 12 deletions(-) diff --git a/pkg/batchssh/fetch.go b/pkg/batchssh/fetch.go index 1de1321..bcb9b1e 100644 --- a/pkg/batchssh/fetch.go +++ b/pkg/batchssh/fetch.go @@ -6,7 +6,6 @@ import ( "os" "path" "path/filepath" - "strings" "github.com/pkg/sftp" @@ -66,11 +65,6 @@ func fetchFile( ftpC *sftp.Client, srcFile, dstDir, host string, ) error { - homeDir := os.Getenv("HOME") - if strings.HasPrefix(srcFile, "~/") { - srcFile = strings.Replace(srcFile, "~", homeDir, 1) - } - remoteFile, err := ftpC.Open(srcFile) if err != nil { if errors.Is(err, os.ErrNotExist) { diff --git a/pkg/batchssh/fetch_zip.go b/pkg/batchssh/fetch_zip.go index 0daa383..7b9d5bd 100644 --- a/pkg/batchssh/fetch_zip.go +++ b/pkg/batchssh/fetch_zip.go @@ -6,7 +6,6 @@ import ( "os" "path" "path/filepath" - "strings" "time" "github.com/pkg/sftp" @@ -106,11 +105,6 @@ func fetchZipFile( ftpC *sftp.Client, srcZipFile, dstDir string, ) error { - homeDir := os.Getenv("HOME") - if strings.HasPrefix(dstDir, "~/") { - srcZipFile = strings.Replace(dstDir, "~", homeDir, 1) - } - srcZipFileName := filepath.Base(srcZipFile) dstZipFile := path.Join(dstDir, srcZipFileName)