Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

build: modernize with "go fix -stringscut": use strings.Cut

Nick Craig-Wood7b002153bd1d
diff --git a/backend/chunker/chunker_internal_test.go b/backend/chunker/chunker_internal_test.go
index 19f665fd8..2f9f1fef0 100644
--- a/backend/chunker/chunker_internal_test.go
+++ b/backend/chunker/chunker_internal_test.go
@@ -43,7 +43,7 @@ func testPutLarge(t *testing.T, f *Fs, kilobytes int) {
type settings map[string]any
func deriveFs(ctx context.Context, t *testing.T, f fs.Fs, path string, opts settings) fs.Fs {
- fsName := strings.Split(f.Name(), "{")[0] // strip off hash
+ fsName, _, _ := strings.Cut(f.Name(), "{") // strip off hash
configMap := configmap.Simple{}
for key, val := range opts {
configMap[key] = fmt.Sprintf("%v", val)
diff --git a/backend/ftp/ftp_internal_test.go b/backend/ftp/ftp_internal_test.go
index 187f94036..4554ac02b 100644
--- a/backend/ftp/ftp_internal_test.go
+++ b/backend/ftp/ftp_internal_test.go
@@ -43,7 +43,7 @@ func TestCommandEncodingNeutralisesCRLF(t *testing.T) {
type settings map[string]any
func deriveFs(ctx context.Context, t *testing.T, f fs.Fs, opts settings) fs.Fs {
- fsName := strings.Split(f.Name(), "{")[0] // strip off hash
+ fsName, _, _ := strings.Cut(f.Name(), "{") // strip off hash
configMap := configmap.Simple{}
for key, val := range opts {
configMap[key] = fmt.Sprintf("%v", val)
diff --git a/backend/http/http.go b/backend/http/http.go
index 632ccf247..f1afa602b 100644
--- a/backend/http/http.go
+++ b/backend/http/http.go
@@ -543,7 +543,7 @@ func (f *Fs) readDir(ctx context.Context, dir string) (names []string, err error
return nil, fmt.Errorf("failed to readDir: %w", err)
}
- contentType := strings.SplitN(res.Header.Get("Content-Type"), ";", 2)[0]
+ contentType, _, _ := strings.Cut(res.Header.Get("Content-Type"), ";")
switch contentType {
case "text/html":
names, err = parse(u, res.Body)