"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
staticcheck: use result of type assertion to simplify cases
albertony0772cae3142d
diff --git a/backend/union/union.go b/backend/union/union.goindex e1ec53e85..c93fc0649 100644--- a/backend/union/union.go+++ b/backend/union/union.go@@ -85,16 +85,16 @@ func (f *Fs) wrapEntries(entries ...upstream.Entry) (entry, error) {if err != nil {return nil, err}- switch e.(type) {+ switch e := e.(type) {case *upstream.Object:return &Object{- Object: e.(*upstream.Object),+ Object: e,fs: f,co: entries,}, nilcase *upstream.Directory:return &Directory{- Directory: e.(*upstream.Directory),+ Directory: e,cd: entries,}, nildefault:diff --git a/backend/union/upstream/upstream.go b/backend/union/upstream/upstream.goindex c6e906107..06f3b9014 100644--- a/backend/union/upstream/upstream.go+++ b/backend/union/upstream/upstream.go@@ -129,11 +129,11 @@ func (f *Fs) WrapObject(o fs.Object) *Object {// WrapEntry wraps an fs.DirEntry to include the info// of the upstream Fsfunc (f *Fs) WrapEntry(e fs.DirEntry) (Entry, error) {- switch e.(type) {+ switch e := e.(type) {case fs.Object:- return f.WrapObject(e.(fs.Object)), nil+ return f.WrapObject(e), nilcase fs.Directory:- return f.WrapDirectory(e.(fs.Directory)), nil+ return f.WrapDirectory(e), nildefault:return nil, fmt.Errorf("unknown object type %T", e)}diff --git a/fs/operations/reopen.go b/fs/operations/reopen.goindex 1f575d7cc..e0f38cfcb 100644--- a/fs/operations/reopen.go+++ b/fs/operations/reopen.go@@ -59,11 +59,11 @@ func (h *ReOpen) open() error {var hashOption *fs.HashesOptionvar rangeOption *fs.RangeOptionfor _, option := range h.options {- switch option.(type) {+ switch option := option.(type) {case *fs.HashesOption:- hashOption = option.(*fs.HashesOption)+ hashOption = optioncase *fs.RangeOption:- rangeOption = option.(*fs.RangeOption)+ rangeOption = optioncase *fs.HTTPOption:opts = append(opts, option)default: