"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Fixes after running errcheck
Nick Craig-Wood17ffb0855fd2
diff --git a/drive/drive.go b/drive/drive.goindex f04efd469..d5166f96c 100644--- a/drive/drive.go+++ b/drive/drive.go@@ -840,7 +840,7 @@ func (o *FsObjectDrive) Open() (in io.ReadCloser, err error) {return nil, err}if res.StatusCode != 200 {- res.Body.Close()+ _ = res.Body.Close() // ignore errorreturn nil, fmt.Errorf("Bad response: %d: %s", res.StatusCode, res.Status)}return res.Body, nildiff --git a/dropbox/dropbox.go b/dropbox/dropbox.goindex f5ec62624..c4c9b32c3 100644--- a/dropbox/dropbox.go+++ b/dropbox/dropbox.go@@ -574,7 +574,7 @@ func metadataKey(path string) string {// NB File system is case insensitivepath = strings.ToLower(path)hash := md5.New()- hash.Write([]byte(path))+ _, _ = hash.Write([]byte(path))return fmt.Sprintf("%x", hash.Sum(nil))}@@ -635,8 +635,7 @@ func (o *FsObjectDropbox) readMetaData() (err error) {}// Last resort- o.readEntryAndSetMetadata()- return nil+ return o.readEntryAndSetMetadata()}// ModTime returns the modification time of the objectdiff --git a/fs/operations.go b/fs/operations.goindex 28bed028b..ab78a7654 100644--- a/fs/operations.go+++ b/fs/operations.go@@ -504,19 +504,21 @@ func Rmdir(f Fs) error {//// FIXME doesn't delete local directoriesfunc Purge(f Fs) error {+ var err errorif purger, ok := f.(Purger); ok {if Config.DryRun {Debug(f, "Not purging as --dry-run set")} else {- err := purger.Purge()- if err != nil {- Stats.Error()- return err- }+ err = purger.Purge()}} else {+ // DeleteFiles and Rmdir observe --dry-runDeleteFiles(f.List())- Rmdir(f)+ err = Rmdir(f)+ }+ if err != nil {+ Stats.Error()+ return err}return nil}diff --git a/googlecloudstorage/googlecloudstorage.go b/googlecloudstorage/googlecloudstorage.goindex 83dcc5184..d08fdc66d 100644--- a/googlecloudstorage/googlecloudstorage.go+++ b/googlecloudstorage/googlecloudstorage.go@@ -530,7 +530,7 @@ func (o *FsObjectStorage) Open() (in io.ReadCloser, err error) {return nil, err}if res.StatusCode != 200 {- res.Body.Close()+ _ = res.Body.Close() // ignore errorreturn nil, fmt.Errorf("Bad response: %d: %s", res.StatusCode, res.Status)}return res.Body, nildiff --git a/local/local.go b/local/local.goindex ecdd8b9f2..0b48889c0 100644--- a/local/local.go+++ b/local/local.go@@ -217,12 +217,15 @@ func (f *FsLocal) readPrecision() (precision time.Duration) {}path := fd.Name()// fmt.Println("Created temp file", path)- fd.Close()+ err = fd.Close()+ if err != nil {+ return time.Second+ }// Delete it on returndefer func() {// fmt.Println("Remove temp file")- os.Remove(path)+ _ = os.Remove(path) // ignore error}()// Find the minimum duration we can detectdiff --git a/rclone.go b/rclone.goindex 48eb08291..9b290861d 100644--- a/rclone.go+++ b/rclone.go@@ -265,7 +265,11 @@ func ParseFlags() {fs.Stats.Error()log.Fatal(err)}- pprof.StartCPUProfile(f)+ err = pprof.StartCPUProfile(f)+ if err != nil {+ fs.Stats.Error()+ log.Fatal(err)+ }defer pprof.StopCPUProfile()}}