"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
mountlib: fix code quality warnings
Nick Craig-Woodc1d5faa32a6c
diff --git a/cmd/mountlib/fs.go b/cmd/mountlib/fs.goindex 911ab5593..0c0535cbd 100644--- a/cmd/mountlib/fs.go+++ b/cmd/mountlib/fs.go@@ -78,8 +78,8 @@ func NewInode() (inode uint64) {}// Lookup finds the Node by path starting from the root-func (f *FS) Lookup(path string) (node Node, err error) {- node = f.root+func (fsys *FS) Lookup(path string) (node Node, err error) {+ node = fsys.rootfor path != "" {i := strings.IndexRune(path, '/')var name string@@ -106,7 +106,7 @@ func (f *FS) Lookup(path string) (node Node, err error) {// Statfs is called to obtain file system metadata.// It should write that data to resp.-func (f *FS) Statfs() error {+func (fsys *FS) Statfs() error {/* FIXMEconst blockSize = 4096const fsBlocks = (1 << 50) / blockSizediff --git a/cmd/mountlib/mounttest/dir.go b/cmd/mountlib/mounttest/dir.goindex a1c52f328..03d088aa5 100644--- a/cmd/mountlib/mounttest/dir.go+++ b/cmd/mountlib/mounttest/dir.go@@ -10,6 +10,7 @@ import ("github.com/stretchr/testify/require")+// TestDirLs checks out listingfunc TestDirLs(t *testing.T) {run.skipIfNoFUSE(t)@@ -26,6 +27,7 @@ func TestDirLs(t *testing.T) {run.checkDir(t, "")}+// TestDirCreateAndRemoveDir tests creating and removing a directoryfunc TestDirCreateAndRemoveDir(t *testing.T) {run.skipIfNoFUSE(t)@@ -44,6 +46,7 @@ func TestDirCreateAndRemoveDir(t *testing.T) {run.checkDir(t, "")}+// TestDirCreateAndRemoveFile tests creating and removing a filefunc TestDirCreateAndRemoveFile(t *testing.T) {run.skipIfNoFUSE(t)@@ -63,6 +66,7 @@ func TestDirCreateAndRemoveFile(t *testing.T) {run.checkDir(t, "")}+// TestDirRenameFile tests renaming a filefunc TestDirRenameFile(t *testing.T) {run.skipIfNoFUSE(t)@@ -91,6 +95,7 @@ func TestDirRenameFile(t *testing.T) {run.checkDir(t, "")}+// TestDirRenameEmptyDir tests renaming and empty directoryfunc TestDirRenameEmptyDir(t *testing.T) {run.skipIfNoFUSE(t)@@ -111,6 +116,7 @@ func TestDirRenameEmptyDir(t *testing.T) {run.checkDir(t, "")}+// TestDirRenameFullDir tests renaming a full directoryfunc TestDirRenameFullDir(t *testing.T) {run.skipIfNoFUSE(t)@@ -133,6 +139,7 @@ func TestDirRenameFullDir(t *testing.T) {run.checkDir(t, "")}+// TestDirModTime tests mod timesfunc TestDirModTime(t *testing.T) {run.skipIfNoFUSE(t)@@ -150,6 +157,7 @@ func TestDirModTime(t *testing.T) {run.rmdir(t, "dir")}+// TestDirCacheFlush tests fluching the dir cachefunc TestDirCacheFlush(t *testing.T) {run.skipIfNoFUSE(t)@@ -189,6 +197,7 @@ func TestDirCacheFlush(t *testing.T) {run.checkDir(t, "")}+// TestDirCacheFlushOnDirRename tests flushing the dir cache on renamefunc TestDirCacheFlushOnDirRename(t *testing.T) {run.skipIfNoFUSE(t)run.mkdir(t, "dir")diff --git a/cmd/mountlib/mounttest/file.go b/cmd/mountlib/mounttest/file.goindex 5a03c528c..60db071db 100644--- a/cmd/mountlib/mounttest/file.go+++ b/cmd/mountlib/mounttest/file.go@@ -9,6 +9,7 @@ import ("github.com/stretchr/testify/require")+// TestFileModTime tests mod times on filesfunc TestFileModTime(t *testing.T) {run.skipIfNoFUSE(t)@@ -27,6 +28,7 @@ func TestFileModTime(t *testing.T) {run.rm(t, "file")}+// TestFileModTimeWithOpenWriters tests mod time on open filesfunc TestFileModTimeWithOpenWriters(t *testing.T) {run.skipIfNoFUSE(t)diff --git a/cmd/mountlib/mounttest/fs.go b/cmd/mountlib/mounttest/fs.goindex 6922e9aa6..9fe05cd5c 100644--- a/cmd/mountlib/mounttest/fs.go+++ b/cmd/mountlib/mounttest/fs.go@@ -17,7 +17,7 @@ import ("github.com/ncw/rclone/cmd/mountlib""github.com/ncw/rclone/fs"- _ "github.com/ncw/rclone/fs/all"+ _ "github.com/ncw/rclone/fs/all" // import all the file systems"github.com/ncw/rclone/fstest""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -35,8 +35,10 @@ var ()type (+ // UnmountFn is called to unmount the file systemUnmountFn func() error- MountFn func(f fs.Fs, mountpoint string) (*mountlib.FS, <-chan error, func() error, error)+ // MountFn is called to mount the file system+ MountFn func(f fs.Fs, mountpoint string) (*mountlib.FS, <-chan error, func() error, error))var (@@ -294,8 +296,8 @@ func (r *Run) rmdir(t *testing.T, filepath string) {require.NoError(t, err)}-// Check that the Fs is mounted by seeing if the mountpoint is-// in the mount output+// TestMount checks that the Fs is mounted by seeing if the mountpoint+// is in the mount outputfunc TestMount(t *testing.T) {run.skipIfNoFUSE(t)@@ -304,7 +306,7 @@ func TestMount(t *testing.T) {assert.Contains(t, string(out), run.mountPath)}-// Check root directory is present and correct+// TestRoot checks root directory is present and correctfunc TestRoot(t *testing.T) {run.skipIfNoFUSE(t)diff --git a/cmd/mountlib/mounttest/read.go b/cmd/mountlib/mounttest/read.goindex 81a69eb61..6489841aa 100644--- a/cmd/mountlib/mounttest/read.go+++ b/cmd/mountlib/mounttest/read.go@@ -9,7 +9,7 @@ import ("github.com/stretchr/testify/assert")-// Read by byte including don't read any bytes+// TestReadByByte reads by byte including don't read any bytesfunc TestReadByByte(t *testing.T) {run.skipIfNoFUSE(t)@@ -34,6 +34,7 @@ func TestReadByByte(t *testing.T) {run.rm(t, "testfile")}+// TestReadChecksum checks the checksum reading is workingfunc TestReadChecksum(t *testing.T) {run.skipIfNoFUSE(t)@@ -73,7 +74,7 @@ func TestReadChecksum(t *testing.T) {run.rm(t, "bigfile")}-// Test seeking+// TestReadSeek test seekingfunc TestReadSeek(t *testing.T) {run.skipIfNoFUSE(t)diff --git a/cmd/mountlib/mounttest/write.go b/cmd/mountlib/mounttest/write.goindex fbf44c990..d28468763 100644--- a/cmd/mountlib/mounttest/write.go+++ b/cmd/mountlib/mounttest/write.go@@ -9,7 +9,7 @@ import ("github.com/stretchr/testify/require")-// Test writing a file with no write()'s to it+// TestWriteFileNoWrite tests writing a file with no write()'s to itfunc TestWriteFileNoWrite(t *testing.T) {run.skipIfNoFUSE(t)@@ -27,7 +27,7 @@ func TestWriteFileNoWrite(t *testing.T) {run.rm(t, "testnowrite")}-// Test open file in directory listing+// FIXMETestWriteOpenFileInDirListing tests open file in directory listingfunc FIXMETestWriteOpenFileInDirListing(t *testing.T) {run.skipIfNoFUSE(t)@@ -42,7 +42,7 @@ func FIXMETestWriteOpenFileInDirListing(t *testing.T) {run.rm(t, "testnowrite")}-// Test writing a file and reading it back+// TestWriteFileWrite tests writing a file and reading it backfunc TestWriteFileWrite(t *testing.T) {run.skipIfNoFUSE(t)@@ -53,7 +53,7 @@ func TestWriteFileWrite(t *testing.T) {run.rm(t, "testwrite")}-// Test overwriting a file+// TestWriteFileOverwrite tests overwriting a filefunc TestWriteFileOverwrite(t *testing.T) {run.skipIfNoFUSE(t)@@ -65,7 +65,7 @@ func TestWriteFileOverwrite(t *testing.T) {run.rm(t, "testwrite")}-// Test Fsync+// TestWriteFileFsync tests Fsync//// NB the code for this is in file.go rather than write.gofunc TestWriteFileFsync(t *testing.T) {diff --git a/cmd/mountlib/write.go b/cmd/mountlib/write.goindex 68c2221b4..e2dae039b 100644--- a/cmd/mountlib/write.go+++ b/cmd/mountlib/write.go@@ -91,7 +91,7 @@ func (fh *WriteFileHandle) Write(data []byte, offset int64) (written int64, errreturn written, nil}-// Returns the offset of the file pointer+// Offset returns the offset of the file pointerfunc (fh *WriteFileHandle) Offset() (offset int64) {return fh.offset}