diff options
| author | Petter Rasmussen | 2016-02-13 11:46:03 +0100 | 
|---|---|---|
| committer | Petter Rasmussen | 2016-02-13 11:46:03 +0100 | 
| commit | f9d75405d586b3b4e196ad5b9f749b3c99faf55c (patch) | |
| tree | 11aac85baea4ffead7b57270decb36d8f98f5bb5 /drive/sync_download.go | |
| parent | 60c06768d323e17ad814a7aabdd509453af2a422 (diff) | |
| download | gdrive-f9d75405d586b3b4e196ad5b9f749b3c99faf55c.tar.bz2 | |
Move dry run check out of loop
Diffstat (limited to 'drive/sync_download.go')
| -rw-r--r-- | drive/sync_download.go | 12 | 
1 files changed, 4 insertions, 8 deletions
| diff --git a/drive/sync_download.go b/drive/sync_download.go index ec496e7..918c731 100644 --- a/drive/sync_download.go +++ b/drive/sync_download.go @@ -145,10 +145,6 @@ func (self *Drive) downloadMissingFiles(files *syncFiles, args DownloadSyncArgs)          }          fmt.Fprintf(args.Out, "[%04d/%04d] Downloading %s -> %s\n", i + 1, missingCount, rf.relPath, filepath.Join(filepath.Base(args.Path), rf.relPath)) -        if args.DryRun { -            continue -        } -          err = self.downloadRemoteFile(rf.file.Id, absPath, args, 0)          if err != nil {              return err @@ -177,10 +173,6 @@ func (self *Drive) downloadChangedFiles(changedFiles []*changedFile, args Downlo          }          fmt.Fprintf(args.Out, "[%04d/%04d] Downloading %s -> %s\n", i + 1, changedCount, cf.remote.relPath, filepath.Join(filepath.Base(args.Path), cf.remote.relPath)) -        if args.DryRun { -            continue -        } -          err = self.downloadRemoteFile(cf.remote.file.Id, absPath, args, 0)          if err != nil {              return err @@ -191,6 +183,10 @@ func (self *Drive) downloadChangedFiles(changedFiles []*changedFile, args Downlo  }  func (self *Drive) downloadRemoteFile(id, fpath string, args DownloadSyncArgs, try int) error { +    if args.DryRun { +        return nil +    } +      res, err := self.service.Files.Get(id).Download()      if err != nil {          if isBackendError(err) && try < MaxBackendErrorRetries { | 
