From ccc201ea5fc935f344a981575d868fd971e2b2ad Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Tue, 11 Apr 2017 20:08:14 +0200 Subject: [PATCH] remove unused code --- src/restic/backend/sftp/sftp.go | 36 -------------------------------- src/restic/backend/sftp/split.go | 2 -- 2 files changed, 38 deletions(-) diff --git a/src/restic/backend/sftp/sftp.go b/src/restic/backend/sftp/sftp.go index 297f33f29..b6f71b4c3 100644 --- a/src/restic/backend/sftp/sftp.go +++ b/src/restic/backend/sftp/sftp.go @@ -20,10 +20,6 @@ import ( "github.com/pkg/sftp" ) -const ( - tempfileRandomSuffixLength = 10 -) - // SFTP is a backend in a directory accessed via SFTP. type SFTP struct { c *sftp.Client @@ -263,38 +259,6 @@ func (r *SFTP) mkdirAll(dir string, mode os.FileMode) error { return r.c.Chmod(dir, mode) } -// Rename temp file to final name according to type and name. -func (r *SFTP) renameFile(oldname string, h restic.Handle) error { - filename := r.Filename(h) - - // create directories if necessary - if h.Type == restic.DataFile { - err := r.mkdirAll(path.Dir(filename), backend.Modes.Dir) - if err != nil { - return err - } - } - - // test if new file exists - if _, err := r.c.Lstat(filename); err == nil { - return errors.Errorf("Close(): file %v already exists", filename) - } - - err := r.c.Rename(oldname, filename) - if err != nil { - return errors.Wrap(err, "Rename") - } - - // set mode to read-only - fi, err := r.c.Lstat(filename) - if err != nil { - return errors.Wrap(err, "Lstat") - } - - err = r.c.Chmod(filename, fi.Mode()&os.FileMode(^uint32(0222))) - return errors.Wrap(err, "Chmod") -} - // Join joins the given paths and cleans them afterwards. This always uses // forward slashes, which is required by sftp. func Join(parts ...string) string { diff --git a/src/restic/backend/sftp/split.go b/src/restic/backend/sftp/split.go index 9f5174a82..dd6f68db9 100644 --- a/src/restic/backend/sftp/split.go +++ b/src/restic/backend/sftp/split.go @@ -5,8 +5,6 @@ import ( "unicode" ) -const data = `"foo" "bar" baz "test argument" another 'test arg' "last \" argument" 'another \" last argument'` - // shellSplitter splits a command string into separater arguments. It supports // single and double quoted strings. type shellSplitter struct {