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: fix gocritic lint issue unslice

albertony59501fcdb6f8
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index 662be58a7..358886404 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -2094,7 +2094,6 @@ func (w *azChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader
return 0, nil
}
md5sum := m.Sum(nil)
- transactionalMD5 := md5sum[:]
// increment the blockID and save the blocks for finalize
var binaryBlockID [8]byte // block counter as LSB first 8 bytes
@@ -2117,7 +2116,7 @@ func (w *azChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader
}
options := blockblob.StageBlockOptions{
// Specify the transactional md5 for the body, to be validated by the service.
- TransactionalValidation: blob.TransferValidationTypeMD5(transactionalMD5),
+ TransactionalValidation: blob.TransferValidationTypeMD5(md5sum),
}
_, err = w.ui.blb.StageBlock(ctx, blockID, &readSeekCloser{Reader: reader, Seeker: reader}, &options)
if err != nil {
diff --git a/backend/oracleobjectstorage/multipart.go b/backend/oracleobjectstorage/multipart.go
index 7ecdf16bd..c0d9d4600 100644
--- a/backend/oracleobjectstorage/multipart.go
+++ b/backend/oracleobjectstorage/multipart.go
@@ -148,7 +148,7 @@ func (w *objectChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, rea
}
md5sumBinary := m.Sum([]byte{})
w.addMd5(&md5sumBinary, int64(chunkNumber))
- md5sum := base64.StdEncoding.EncodeToString(md5sumBinary[:])
+ md5sum := base64.StdEncoding.EncodeToString(md5sumBinary)
// Object storage requires 1 <= PartNumber <= 10000
ossPartNumber := chunkNumber + 1
@@ -279,7 +279,7 @@ func (w *objectChunkWriter) addMd5(md5binary *[]byte, chunkNumber int64) {
if extend := end - int64(len(w.md5s)); extend > 0 {
w.md5s = append(w.md5s, make([]byte, extend)...)
}
- copy(w.md5s[start:end], (*md5binary)[:])
+ copy(w.md5s[start:end], (*md5binary))
}
func (o *Object) prepareUpload(ctx context.Context, src fs.ObjectInfo, options []fs.OpenOption) (ui uploadInfo, err error) {
diff --git a/backend/s3/s3.go b/backend/s3/s3.go
index 474fe6bcb..b691a2cf3 100644
--- a/backend/s3/s3.go
+++ b/backend/s3/s3.go
@@ -5964,7 +5964,7 @@ func (w *s3ChunkWriter) addMd5(md5binary *[]byte, chunkNumber int64) {
if extend := end - int64(len(w.md5s)); extend > 0 {
w.md5s = append(w.md5s, make([]byte, extend)...)
}
- copy(w.md5s[start:end], (*md5binary)[:])
+ copy(w.md5s[start:end], (*md5binary))
}
// WriteChunk will write chunk number with reader bytes, where chunk number >= 0
@@ -5994,7 +5994,7 @@ func (w *s3ChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader
}
md5sumBinary := m.Sum([]byte{})
w.addMd5(&md5sumBinary, int64(chunkNumber))
- md5sum := base64.StdEncoding.EncodeToString(md5sumBinary[:])
+ md5sum := base64.StdEncoding.EncodeToString(md5sumBinary)
// S3 requires 1 <= PartNumber <= 10000
s3PartNumber := aws.Int32(int32(chunkNumber + 1))
diff --git a/lib/buildinfo/osversion_windows.go b/lib/buildinfo/osversion_windows.go
index 0626d4227..a32275606 100644
--- a/lib/buildinfo/osversion_windows.go
+++ b/lib/buildinfo/osversion_windows.go
@@ -93,5 +93,5 @@ func getRegistryVersionString(name string) string {
return ""
}
- return windows.UTF16ToString(regBuf[:])
+ return windows.UTF16ToString(regBuf)
}