From 0d475958c704c25b5053383e6d997e9606bb9d5e Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 18 Mar 2019 11:23:00 +0000 Subject: [PATCH] Fix errors discovered with go vet nilness tool --- backend/onedrive/onedrive.go | 7 +------ backend/opendrive/opendrive.go | 3 --- fs/rc/job.go | 4 ++-- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go index ba6eb8010..baea799ad 100644 --- a/backend/onedrive/onedrive.go +++ b/backend/onedrive/onedrive.go @@ -708,9 +708,7 @@ func (f *Fs) List(dir string) (entries fs.DirEntries, err error) { id := info.GetID() f.dirCache.Put(remote, id) d := fs.NewDir(remote, time.Time(info.GetLastModifiedDateTime())).SetID(id) - if folder != nil { - d.SetItems(folder.ChildCount) - } + d.SetItems(folder.ChildCount) entries = append(entries, d) } else { o, err := f.newObjectWithInfo(remote, info) @@ -824,9 +822,6 @@ func (f *Fs) purgeCheck(dir string, check bool) error { return err } f.dirCache.FlushDir(dir) - if err != nil { - return err - } return nil } diff --git a/backend/opendrive/opendrive.go b/backend/opendrive/opendrive.go index 127fdc7e7..d65106ca5 100644 --- a/backend/opendrive/opendrive.go +++ b/backend/opendrive/opendrive.go @@ -287,9 +287,6 @@ func (f *Fs) purgeCheck(dir string, check bool) error { return err } f.dirCache.FlushDir(dir) - if err != nil { - return err - } return nil } diff --git a/fs/rc/job.go b/fs/rc/job.go index daf41b418..ea2621e0b 100644 --- a/fs/rc/job.go +++ b/fs/rc/job.go @@ -188,8 +188,8 @@ func rcJobStatus(in Params) (out Params, err error) { defer job.mu.Unlock() out = make(Params) err = Reshape(&out, job) - if job == nil { - return nil, errors.New("Reshape failed in job status") + if err != nil { + return nil, errors.Wrap(err, "reshape failed in job status") } return out, nil }