"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
build: modernize with "go fix -slicescontains": use slices.Contains
Nick Craig-Wood9f9fd82923b2
diff --git a/backend/webdav/api/types.go b/backend/webdav/api/types.goindex 5ed3dfecc..6945360ba 100644--- a/backend/webdav/api/types.go+++ b/backend/webdav/api/types.go@@ -4,6 +4,7 @@ package apiimport ("encoding/xml""regexp"+ "slices""strconv""strings""sync"@@ -107,12 +108,7 @@ func (p *Prop) StatusOK() bool {if len(p.Status) == 0 {return true}- for _, statusStr := range p.Status {- if parseStatus2XX.MatchString(statusStr) {- return true- }- }- return false+ return slices.ContainsFunc(p.Status, parseStatus2XX.MatchString)}// Hashes returns a map of all checksums - may be nildiff --git a/cmd/archive/extract/extract.go b/cmd/archive/extract/extract.goindex 0ddbc7ed7..c518788cf 100644--- a/cmd/archive/extract/extract.go+++ b/cmd/archive/extract/extract.go@@ -8,6 +8,7 @@ import ("errors""fmt""path"+ "slices""strings""github.com/mholt/archives"@@ -219,10 +220,8 @@ func ArchiveExtract(ctx context.Context, dst fs.Fs, dstDir string, src fs.Fs, srfunc destPath(nameInArchive, dstDir string) (string, error) {remote := strings.TrimPrefix(nameInArchive, "./")isSeparator := func(r rune) bool { return r == '/' || r == '\\' }- for _, segment := range strings.FieldsFunc(remote, isSeparator) {- if segment == ".." {- return "", fmt.Errorf("refusing to extract archive entry %q with a %q path component", nameInArchive, "..")- }+ if slices.Contains(strings.FieldsFunc(remote, isSeparator), "..") {+ return "", fmt.Errorf("refusing to extract archive entry %q with a %q path component", nameInArchive, "..")}if remote == "" {return "", nildiff --git a/fs/config/config.go b/fs/config/config.goindex 9f6ec5956..32b8d1216 100644--- a/fs/config/config.go+++ b/fs/config/config.go@@ -11,6 +11,7 @@ import ("path/filepath""regexp""runtime"+ "slices""strings""time"@@ -682,10 +683,8 @@ func UnsetRemote(name string, keys ...string) (removed []string, err error) {if GetValue(name, "type") == "" {return nil, fmt.Errorf("remote %q doesn't exist", name)}- for _, key := range keys {- if key == "type" {- return nil, errors.New(`can't unset the "type" of a remote - use "config delete" to remove the whole remote`)- }+ if slices.Contains(keys, "type") {+ return nil, errors.New(`can't unset the "type" of a remote - use "config delete" to remove the whole remote`)}for _, key := range keys {if FileDeleteKey(name, key) {