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

Simplify literals (after running gofmt -s over the code)

Nick Craig-Wood88cca8a6eba4
diff --git a/fs/hash_test.go b/fs/hash_test.go
index a171ced67..edac5b408 100644
--- a/fs/hash_test.go
+++ b/fs/hash_test.go
@@ -103,7 +103,7 @@ type hashTest struct {
}
var hashTestSet = []hashTest{
- hashTest{
+ {
input: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14},
output: map[fs.HashType]string{
fs.HashMD5: "bf13fc19e5151ac57d4252e0e0f87abe",
@@ -111,7 +111,7 @@ var hashTestSet = []hashTest{
},
},
// Empty data set
- hashTest{
+ {
input: []byte{},
output: map[fs.HashType]string{
fs.HashMD5: "d41d8cd98f00b204e9800998ecf8427e",
diff --git a/local/local.go b/local/local.go
index cde0100c3..9309beec9 100644
--- a/local/local.go
+++ b/local/local.go
@@ -23,7 +23,7 @@ func init() {
Name: "local",
Description: "Local Disk",
NewFs: NewFs,
- Options: []fs.Option{fs.Option{
+ Options: []fs.Option{{
Name: "nounc",
Help: "Disable UNC (long path names) conversion on Windows",
Optional: true,
diff --git a/local/tests_test.go b/local/tests_test.go
index 9a2fe9176..c98ba6cab 100644
--- a/local/tests_test.go
+++ b/local/tests_test.go
@@ -52,9 +52,9 @@ func TestUncPaths(t *testing.T) {
}
var utf8Tests = [][2]string{
- [2]string{"ABC", "ABC"},
- [2]string{string([]byte{0x80}), "�"},
- [2]string{string([]byte{'a', 0x80, 'b'}), "a�b"},
+ {"ABC", "ABC"},
+ {string([]byte{0x80}), "�"},
+ {string([]byte{'a', 0x80, 'b'}), "a�b"},
}
func TestCleanUtf8(t *testing.T) {
@@ -71,13 +71,13 @@ func TestCleanUtf8(t *testing.T) {
// Test Windows character replacements
var testsWindows = [][2]string{
- [2]string{`c:\temp`, `c:\temp`},
- [2]string{`\\?\UNC\theserver\dir\file.txt`, `\\?\UNC\theserver\dir\file.txt`},
- [2]string{`//?/UNC/theserver/dir\file.txt`, `//?/UNC/theserver/dir\file.txt`},
- [2]string{"c:/temp", "c:/temp"},
- [2]string{"/temp/file.txt", "/temp/file.txt"},
- [2]string{`!\"#¤%&/()=;:*^?+-`, "!\\_#¤%&/()=;__^_+-"},
- [2]string{`<>"|?*:&\<>"|?*:&\<>"|?*:&`, "_______&\\_______&\\_______&"},
+ {`c:\temp`, `c:\temp`},
+ {`\\?\UNC\theserver\dir\file.txt`, `\\?\UNC\theserver\dir\file.txt`},
+ {`//?/UNC/theserver/dir\file.txt`, `//?/UNC/theserver/dir\file.txt`},
+ {"c:/temp", "c:/temp"},
+ {"/temp/file.txt", "/temp/file.txt"},
+ {`!\"#¤%&/()=;:*^?+-`, "!\\_#¤%&/()=;__^_+-"},
+ {`<>"|?*:&\<>"|?*:&\<>"|?*:&`, "_______&\\_______&\\_______&"},
}
func TestCleanWindows(t *testing.T) {
diff --git a/s3/v2sign.go b/s3/v2sign.go
index 8398741e9..23048ede9 100644
--- a/s3/v2sign.go
+++ b/s3/v2sign.go
@@ -14,25 +14,25 @@ import (
// URL parameters that need to be added to the signature
var s3ParamsToSign = map[string]struct{}{
- "acl": struct{}{},
- "location": struct{}{},
- "logging": struct{}{},
- "notification": struct{}{},
- "partNumber": struct{}{},
- "policy": struct{}{},
- "requestPayment": struct{}{},
- "torrent": struct{}{},
- "uploadId": struct{}{},
- "uploads": struct{}{},
- "versionId": struct{}{},
- "versioning": struct{}{},
- "versions": struct{}{},
- "response-content-type": struct{}{},
- "response-content-language": struct{}{},
- "response-expires": struct{}{},
- "response-cache-control": struct{}{},
- "response-content-disposition": struct{}{},
- "response-content-encoding": struct{}{},
+ "acl": {},
+ "location": {},
+ "logging": {},
+ "notification": {},
+ "partNumber": {},
+ "policy": {},
+ "requestPayment": {},
+ "torrent": {},
+ "uploadId": {},
+ "uploads": {},
+ "versionId": {},
+ "versioning": {},
+ "versions": {},
+ "response-content-type": {},
+ "response-content-language": {},
+ "response-expires": {},
+ "response-cache-control": {},
+ "response-content-disposition": {},
+ "response-content-encoding": {},
}
// sign signs requests using v2 auth