small cleanup:

- be explicit when discarding returned errors from .Close(), etc.
- remove named return values from funcs when naked return not used
- fix some "err" shadowing when redeclaration not needed
This commit is contained in:
George Armhold
2017-10-25 12:03:55 -04:00
parent 8d37b723ca
commit bcdebfb84e
8 changed files with 12 additions and 11 deletions

View File

@@ -109,7 +109,7 @@ func newLock(ctx context.Context, repo Repository, excl bool) (*Lock, error) {
time.Sleep(waitBeforeLockCheck)
if err = lock.checkForOtherLocks(ctx); err != nil {
lock.Unlock()
_ = lock.Unlock()
return nil, err
}

View File

@@ -51,7 +51,7 @@ func (res *Restorer) restoreTo(ctx context.Context, dst string, dir string, tree
debug.Log("SelectFilter returned %v %v", selectedForRestore, childMayBeSelected)
if selectedForRestore {
err := res.restoreNodeTo(ctx, node, dir, dst, idx)
err = res.restoreNodeTo(ctx, node, dir, dst, idx)
if err != nil {
return err
}
@@ -74,7 +74,8 @@ func (res *Restorer) restoreTo(ctx context.Context, dst string, dir string, tree
if selectedForRestore {
// Restore directory timestamp at the end. If we would do it earlier, restoring files within
// the directory would overwrite the timestamp of the directory they are in.
if err := node.RestoreTimestamps(filepath.Join(dst, dir, node.Name)); err != nil {
err = node.RestoreTimestamps(filepath.Join(dst, dir, node.Name))
if err != nil {
return err
}
}