Skip to content

Commit

Permalink
No need to open file
Browse files Browse the repository at this point in the history
  • Loading branch information
prasmussen committed Feb 14, 2016
1 parent 46f65e8 commit 2b11e0b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions drive/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,9 @@ func (self *Drive) Upload(args UploadArgs) error {
}

func (self *Drive) upload(args UploadArgs) error {
f, err := os.Open(args.Path)
info, err := os.Stat(args.Path)
if err != nil {
return fmt.Errorf("Failed to open file: %s", err)
}

info, err := f.Stat()
if err != nil {
return fmt.Errorf("Failed getting file metadata: %s", err)
return fmt.Errorf("Failed stat file: %s", err)
}

if info.IsDir() && !args.Recursive {
Expand Down

0 comments on commit 2b11e0b

Please sign in to comment.