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: apply gofmt from go1.13 to change case of number literals

Nick Craig-Woodffa1dac10bfc
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index b379c4767..d9e383e83 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -1115,7 +1115,7 @@ func (o *Object) parseTimeString(timeString string) (err error) {
fs.Debugf(o, "Failed to parse mod time string %q: %v", timeString, err)
return err
}
- o.modTime = time.Unix(unixMilliseconds/1E3, (unixMilliseconds%1E3)*1E6).UTC()
+ o.modTime = time.Unix(unixMilliseconds/1e3, (unixMilliseconds%1e3)*1e6).UTC()
return nil
}
diff --git a/backend/b2/api/types.go b/backend/b2/api/types.go
index 8bcaeb0cf..fcf0c9834 100644
--- a/backend/b2/api/types.go
+++ b/backend/b2/api/types.go
@@ -50,7 +50,7 @@ type Timestamp time.Time
// MarshalJSON turns a Timestamp into JSON (in UTC)
func (t *Timestamp) MarshalJSON() (out []byte, err error) {
timestamp := (*time.Time)(t).UTC().UnixNano()
- return []byte(strconv.FormatInt(timestamp/1E6, 10)), nil
+ return []byte(strconv.FormatInt(timestamp/1e6, 10)), nil
}
// UnmarshalJSON turns JSON into a Timestamp
@@ -59,7 +59,7 @@ func (t *Timestamp) UnmarshalJSON(data []byte) error {
if err != nil {
return err
}
- *t = Timestamp(time.Unix(timestamp/1E3, (timestamp%1E3)*1E6).UTC())
+ *t = Timestamp(time.Unix(timestamp/1e3, (timestamp%1e3)*1e6).UTC())
return nil
}
diff --git a/backend/b2/b2.go b/backend/b2/b2.go
index cbdcd9ace..ee05cd02a 100644
--- a/backend/b2/b2.go
+++ b/backend/b2/b2.go
@@ -1453,7 +1453,7 @@ func (o *Object) readMetaData(ctx context.Context) (err error) {
// timeString returns modTime as the number of milliseconds
// elapsed since January 1, 1970 UTC as a decimal string.
func timeString(modTime time.Time) string {
- return strconv.FormatInt(modTime.UnixNano()/1E6, 10)
+ return strconv.FormatInt(modTime.UnixNano()/1e6, 10)
}
// parseTimeString converts a decimal string number of milliseconds
@@ -1468,7 +1468,7 @@ func (o *Object) parseTimeString(timeString string) (err error) {
fs.Debugf(o, "Failed to parse mod time string %q: %v", timeString, err)
return nil
}
- o.modTime = time.Unix(unixMilliseconds/1E3, (unixMilliseconds%1E3)*1E6).UTC()
+ o.modTime = time.Unix(unixMilliseconds/1e3, (unixMilliseconds%1e3)*1e6).UTC()
return nil
}
diff --git a/backend/crypt/cipher_test.go b/backend/crypt/cipher_test.go
index 655ff9b92..31faccd14 100644
--- a/backend/crypt/cipher_test.go
+++ b/backend/crypt/cipher_test.go
@@ -705,16 +705,16 @@ var (
// Test test infrastructure first!
func TestRandomSource(t *testing.T) {
- source := newRandomSource(1E8)
- sink := newRandomSource(1E8)
+ source := newRandomSource(1e8)
+ sink := newRandomSource(1e8)
n, err := io.Copy(sink, source)
assert.NoError(t, err)
- assert.Equal(t, int64(1E8), n)
+ assert.Equal(t, int64(1e8), n)
- source = newRandomSource(1E8)
+ source = newRandomSource(1e8)
buf := make([]byte, 16)
_, _ = source.Read(buf)
- sink = newRandomSource(1E8)
+ sink = newRandomSource(1e8)
_, err = io.Copy(sink, source)
assert.Error(t, err, "Error in stream")
}
@@ -754,23 +754,23 @@ func testEncryptDecrypt(t *testing.T, bufSize int, copySize int64) {
}
func TestEncryptDecrypt1(t *testing.T) {
- testEncryptDecrypt(t, 1, 1E7)
+ testEncryptDecrypt(t, 1, 1e7)
}
func TestEncryptDecrypt32(t *testing.T) {
- testEncryptDecrypt(t, 32, 1E8)
+ testEncryptDecrypt(t, 32, 1e8)
}
func TestEncryptDecrypt4096(t *testing.T) {
- testEncryptDecrypt(t, 4096, 1E8)
+ testEncryptDecrypt(t, 4096, 1e8)
}
func TestEncryptDecrypt65536(t *testing.T) {
- testEncryptDecrypt(t, 65536, 1E8)
+ testEncryptDecrypt(t, 65536, 1e8)
}
func TestEncryptDecrypt65537(t *testing.T) {
- testEncryptDecrypt(t, 65537, 1E8)
+ testEncryptDecrypt(t, 65537, 1e8)
}
var (
@@ -803,7 +803,7 @@ func TestEncryptData(t *testing.T) {
} {
c, err := newCipher(NameEncryptionStandard, "", "", true)
assert.NoError(t, err)
- c.cryptoRand = newRandomSource(1E8) // nodge the crypto rand generator
+ c.cryptoRand = newRandomSource(1e8) // nodge the crypto rand generator
// Check encode works
buf := bytes.NewBuffer(test.in)
@@ -826,7 +826,7 @@ func TestEncryptData(t *testing.T) {
func TestNewEncrypter(t *testing.T) {
c, err := newCipher(NameEncryptionStandard, "", "", true)
assert.NoError(t, err)
- c.cryptoRand = newRandomSource(1E8) // nodge the crypto rand generator
+ c.cryptoRand = newRandomSource(1e8) // nodge the crypto rand generator
z := &zeroes{}
@@ -853,7 +853,7 @@ func TestNewEncrypterErrUnexpectedEOF(t *testing.T) {
fh, err := c.newEncrypter(in, nil)
assert.NoError(t, err)
- n, err := io.CopyN(ioutil.Discard, fh, 1E6)
+ n, err := io.CopyN(ioutil.Discard, fh, 1e6)
assert.Equal(t, io.ErrUnexpectedEOF, err)
assert.Equal(t, int64(32), n)
}
@@ -885,7 +885,7 @@ func (c *closeDetector) Close() error {
func TestNewDecrypter(t *testing.T) {
c, err := newCipher(NameEncryptionStandard, "", "", true)
assert.NoError(t, err)
- c.cryptoRand = newRandomSource(1E8) // nodge the crypto rand generator
+ c.cryptoRand = newRandomSource(1e8) // nodge the crypto rand generator
cd := newCloseDetector(bytes.NewBuffer(file0))
fh, err := c.newDecrypter(cd)
@@ -936,7 +936,7 @@ func TestNewDecrypterErrUnexpectedEOF(t *testing.T) {
fh, err := c.newDecrypter(in)
assert.NoError(t, err)
- n, err := io.CopyN(ioutil.Discard, fh, 1E6)
+ n, err := io.CopyN(ioutil.Discard, fh, 1e6)
assert.Equal(t, io.ErrUnexpectedEOF, err)
assert.Equal(t, int64(16), n)
}
diff --git a/backend/fichier/fichier.go b/backend/fichier/fichier.go
index 619504a00..96153d6b5 100644
--- a/backend/fichier/fichier.go
+++ b/backend/fichier/fichier.go
@@ -298,7 +298,7 @@ func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options .
// This will create a duplicate if we upload a new file without
// checking to see if there is one already - use Put() for that.
func (f *Fs) putUnchecked(ctx context.Context, in io.Reader, remote string, size int64, options ...fs.OpenOption) (fs.Object, error) {
- if size > int64(100E9) {
+ if size > int64(100e9) {
return nil, errors.New("File too big, cant upload")
} else if size == 0 {
return nil, fs.ErrorCantUploadEmptyFiles
diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go
index c73dbef75..8683fccde 100644
--- a/backend/webdav/webdav.go
+++ b/backend/webdav/webdav.go
@@ -835,7 +835,7 @@ func (f *Fs) copyOrMove(ctx context.Context, src fs.Object, remote string, metho
},
}
if f.useOCMtime {
- opts.ExtraHeaders["X-OC-Mtime"] = fmt.Sprintf("%f", float64(src.ModTime(ctx).UnixNano())/1E9)
+ opts.ExtraHeaders["X-OC-Mtime"] = fmt.Sprintf("%f", float64(src.ModTime(ctx).UnixNano())/1e9)
}
err = f.pacer.Call(func() (bool, error) {
resp, err = f.srv.Call(&opts)
@@ -1128,7 +1128,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
if o.fs.useOCMtime || o.fs.hasChecksums {
opts.ExtraHeaders = map[string]string{}
if o.fs.useOCMtime {
- opts.ExtraHeaders["X-OC-Mtime"] = fmt.Sprintf("%f", float64(src.ModTime(ctx).UnixNano())/1E9)
+ opts.ExtraHeaders["X-OC-Mtime"] = fmt.Sprintf("%f", float64(src.ModTime(ctx).UnixNano())/1e9)
}
if o.fs.hasChecksums {
// Set an upload checksum - prefer SHA1
diff --git a/cmd/cmount/fs.go b/cmd/cmount/fs.go
index a53f8765a..9d732be34 100644
--- a/cmd/cmount/fs.go
+++ b/cmd/cmount/fs.go
@@ -267,8 +267,8 @@ func (fsys *FS) Statfs(path string, stat *fuse.Statfs_t) (errc int) {
stat.Blocks = fsBlocks // Total data blocks in file system.
stat.Bfree = fsBlocks // Free blocks in file system.
stat.Bavail = fsBlocks // Free blocks in file system if you're not root.
- stat.Files = 1E9 // Total files in file system.
- stat.Ffree = 1E9 // Free files in file system.
+ stat.Files = 1e9 // Total files in file system.
+ stat.Ffree = 1e9 // Free files in file system.
stat.Bsize = blockSize // Block size
stat.Namemax = 255 // Maximum file name length?
stat.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.
diff --git a/cmd/info/info.go b/cmd/info/info.go
index 51d1fbfee..1c99e12b1 100644
--- a/cmd/info/info.go
+++ b/cmd/info/info.go
@@ -58,7 +58,7 @@ a bit of go code for each one.
`,
Hidden: true,
Run: func(command *cobra.Command, args []string) {
- cmd.CheckArgs(1, 1E6, command, args)
+ cmd.CheckArgs(1, 1e6, command, args)
for i := range args {
f := cmd.NewFsDir(args[i : i+1])
cmd.Run(false, false, command, func() error {
diff --git a/cmd/mount/fs.go b/cmd/mount/fs.go
index e1a44d61b..7943a28d9 100644
--- a/cmd/mount/fs.go
+++ b/cmd/mount/fs.go
@@ -58,8 +58,8 @@ func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.Sta
resp.Blocks = fsBlocks // Total data blocks in file system.
resp.Bfree = fsBlocks // Free blocks in file system.
resp.Bavail = fsBlocks // Free blocks in file system if you're not root.
- resp.Files = 1E9 // Total files in file system.
- resp.Ffree = 1E9 // Free files in file system.
+ resp.Files = 1e9 // Total files in file system.
+ resp.Ffree = 1e9 // Free files in file system.
resp.Bsize = blockSize // Block size
resp.Namelen = 255 // Maximum file name length?
resp.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.
diff --git a/cmd/mount/test/seeker.go b/cmd/mount/test/seeker.go
index 02d144b2c..f35f2a1a0 100644
--- a/cmd/mount/test/seeker.go
+++ b/cmd/mount/test/seeker.go
@@ -16,7 +16,7 @@ import (
var (
// Flags
- iterations = flag.Int("n", 1E6, "Iterations to try")
+ iterations = flag.Int("n", 1e6, "Iterations to try")
maxBlockSize = flag.Int("b", 1024*1024, "Max block size to read")
)
diff --git a/cmd/mount/test/seekers.go b/cmd/mount/test/seekers.go
index 32fd4d1a7..71d08acbc 100644
--- a/cmd/mount/test/seekers.go
+++ b/cmd/mount/test/seekers.go
@@ -17,7 +17,7 @@ import (
var (
// Flags
- iterations = flag.Int("n", 1E6, "Iterations to try")
+ iterations = flag.Int("n", 1e6, "Iterations to try")
maxBlockSize = flag.Int("b", 1024*1024, "Max block size to read")
simultaneous = flag.Int("transfers", 16, "Number of simultaneous files to open")
seeksPerFile = flag.Int("seeks", 8, "Seeks per file")
diff --git a/cmd/rc/rc.go b/cmd/rc/rc.go
index fc5fdd6f3..b60875cb7 100644
--- a/cmd/rc/rc.go
+++ b/cmd/rc/rc.go
@@ -69,7 +69,7 @@ rclone rc server, eg:
Use "rclone rc" to see a list of all possible commands.`,
Run: func(command *cobra.Command, args []string) {
- cmd.CheckArgs(0, 1E9, command, args)
+ cmd.CheckArgs(0, 1e9, command, args)
cmd.Run(false, false, command, func() error {
parseFlags()
if len(args) == 0 {
diff --git a/fs/accounting/stats_test.go b/fs/accounting/stats_test.go
index c04da8dfa..cb0b25243 100644
--- a/fs/accounting/stats_test.go
+++ b/fs/accounting/stats_test.go
@@ -56,8 +56,8 @@ func TestPercentage(t *testing.T) {
assert.Equal(t, percent(9, 1000), "1%")
assert.Equal(t, percent(500, 1000), "50%")
assert.Equal(t, percent(1000, 1000), "100%")
- assert.Equal(t, percent(1E8, 1E9), "10%")
- assert.Equal(t, percent(1E8, 1E9), "10%")
+ assert.Equal(t, percent(1e8, 1e9), "10%")
+ assert.Equal(t, percent(1e8, 1e9), "10%")
assert.Equal(t, percent(0, 0), "-")
assert.Equal(t, percent(100, -100), "-")
assert.Equal(t, percent(-100, 100), "-")
diff --git a/fs/rc/jobs/job_test.go b/fs/rc/jobs/job_test.go
index dbd82e773..bc1ec6b20 100644
--- a/fs/rc/jobs/job_test.go
+++ b/fs/rc/jobs/job_test.go
@@ -101,7 +101,7 @@ var ctxFn = func(ctx context.Context, in rc.Params) (rc.Params, error) {
const (
sleepTime = 100 * time.Millisecond
- floatSleepTime = float64(sleepTime) / 1E9 / 2
+ floatSleepTime = float64(sleepTime) / 1e9 / 2
)
// sleep for some time so job.Duration is non-0
diff --git a/fs/rc/params_test.go b/fs/rc/params_test.go
index 67cd8ab10..bbca1385a 100644
--- a/fs/rc/params_test.go
+++ b/fs/rc/params_test.go
@@ -100,8 +100,8 @@ func TestParamsGetInt64(t *testing.T) {
{int(12), 12, ""},
{int64(13), 13, ""},
{float64(14), 14, ""},
- {float64(9.3E18), 0, "overflows int64"},
- {float64(-9.3E18), 0, "overflows int64"},
+ {float64(9.3e18), 0, "overflows int64"},
+ {float64(-9.3e18), 0, "overflows int64"},
} {
t.Run(fmt.Sprintf("%T=%v", test.value, test.value), func(t *testing.T) {
in := Params{
diff --git a/lib/oauthutil/oauthutil.go b/lib/oauthutil/oauthutil.go
index 1d10384cc..d0ed4f344 100644
--- a/lib/oauthutil/oauthutil.go
+++ b/lib/oauthutil/oauthutil.go
@@ -248,7 +248,7 @@ func (ts *TokenSource) timeToExpiry() time.Duration {
return 0
}
if t.Expiry.IsZero() {
- return 3E9 * time.Second // ~95 years
+ return 3e9 * time.Second // ~95 years
}
return t.Expiry.Sub(time.Now())
}