forked from TrueCloudLab/rclone
Fix niggles found by go vet
This commit is contained in:
parent
2360bf907a
commit
fe68737268
3 changed files with 8 additions and 9 deletions
|
@ -76,7 +76,7 @@ type FsDrive struct {
|
||||||
rootId string // Id of the root directory
|
rootId string // Id of the root directory
|
||||||
foundRoot bool // Whether we have found the root or not
|
foundRoot bool // Whether we have found the root or not
|
||||||
findRootLock sync.Mutex // Protect findRoot from concurrent use
|
findRootLock sync.Mutex // Protect findRoot from concurrent use
|
||||||
dirCache dirCache // Map of directory path to directory id
|
dirCache *dirCache // Map of directory path to directory id
|
||||||
findDirLock sync.Mutex // Protect findDir from concurrent use
|
findDirLock sync.Mutex // Protect findDir from concurrent use
|
||||||
pacer chan struct{} // To pace the operations
|
pacer chan struct{} // To pace the operations
|
||||||
sleepTime time.Duration // Time to sleep for each transaction
|
sleepTime time.Duration // Time to sleep for each transaction
|
||||||
|
@ -101,8 +101,8 @@ type dirCache struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make a new locked map
|
// Make a new locked map
|
||||||
func newDirCache() dirCache {
|
func newDirCache() *dirCache {
|
||||||
d := dirCache{}
|
d := &dirCache{}
|
||||||
d.Flush()
|
d.Flush()
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ func (x *SizeSuffix) String() string {
|
||||||
default:
|
default:
|
||||||
return fmt.Sprintf("%.3fG", float64(*x)/1024/1024/1024)
|
return fmt.Sprintf("%.3fG", float64(*x)/1024/1024/1024)
|
||||||
}
|
}
|
||||||
panic("shouldn't be reached")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a SizeSuffix
|
// Set a SizeSuffix
|
||||||
|
|
|
@ -109,7 +109,7 @@ func TestFsListEmpty(t *testing.T) {
|
||||||
func TestFsListDirEmpty(t *testing.T) {
|
func TestFsListDirEmpty(t *testing.T) {
|
||||||
skipIfNotOk(t)
|
skipIfNotOk(t)
|
||||||
for obj := range remote.ListDir() {
|
for obj := range remote.ListDir() {
|
||||||
t.Error("Found unexpected item %q", obj.Name)
|
t.Errorf("Found unexpected item %q", obj.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ func TestFsListDirRoot(t *testing.T) {
|
||||||
skipIfNotOk(t)
|
skipIfNotOk(t)
|
||||||
rootRemote, err := fs.NewFs(RemoteName)
|
rootRemote, err := fs.NewFs(RemoteName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Failed to make remote %q: %v", RemoteName, err)
|
t.Fatalf("Failed to make remote %q: %v", RemoteName, err)
|
||||||
}
|
}
|
||||||
found := false
|
found := false
|
||||||
for obj := range rootRemote.ListDir() {
|
for obj := range rootRemote.ListDir() {
|
||||||
|
@ -191,7 +191,7 @@ func TestFsListRoot(t *testing.T) {
|
||||||
skipIfNotOk(t)
|
skipIfNotOk(t)
|
||||||
rootRemote, err := fs.NewFs(RemoteName)
|
rootRemote, err := fs.NewFs(RemoteName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Failed to make remote %q: %v", RemoteName, err)
|
t.Fatalf("Failed to make remote %q: %v", RemoteName, err)
|
||||||
}
|
}
|
||||||
// Should either find file1 and file2 or nothing
|
// Should either find file1 and file2 or nothing
|
||||||
found1 := false
|
found1 := false
|
||||||
|
@ -384,7 +384,7 @@ func TestLimitedFs(t *testing.T) {
|
||||||
file2Copy.Path = "z.txt"
|
file2Copy.Path = "z.txt"
|
||||||
fileRemote, err := fs.NewFs(remoteName)
|
fileRemote, err := fs.NewFs(remoteName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Failed to make remote %q: %v", remoteName, err)
|
t.Fatalf("Failed to make remote %q: %v", remoteName, err)
|
||||||
}
|
}
|
||||||
fstest.CheckListing(t, fileRemote, []fstest.Item{file2Copy})
|
fstest.CheckListing(t, fileRemote, []fstest.Item{file2Copy})
|
||||||
_, ok := fileRemote.(*fs.Limited)
|
_, ok := fileRemote.(*fs.Limited)
|
||||||
|
@ -398,7 +398,7 @@ func TestLimitedFsNotFound(t *testing.T) {
|
||||||
remoteName := subRemoteName + "/not found.txt"
|
remoteName := subRemoteName + "/not found.txt"
|
||||||
fileRemote, err := fs.NewFs(remoteName)
|
fileRemote, err := fs.NewFs(remoteName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Failed to make remote %q: %v", remoteName, err)
|
t.Fatalf("Failed to make remote %q: %v", remoteName, err)
|
||||||
}
|
}
|
||||||
fstest.CheckListing(t, fileRemote, []fstest.Item{})
|
fstest.CheckListing(t, fileRemote, []fstest.Item{})
|
||||||
_, ok := fileRemote.(*fs.Limited)
|
_, ok := fileRemote.(*fs.Limited)
|
||||||
|
|
Loading…
Add table
Reference in a new issue