Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Commit

Permalink
gb-vendor: delete old dependency before copypath during restore
Browse files Browse the repository at this point in the history
  • Loading branch information
FiloSottile committed Jan 18, 2016
1 parent ed955a6 commit fd27784
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/gb-vendor/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"flag"
"fmt"
"os"
"path/filepath"

"github.com/constabulary/gb"
Expand Down Expand Up @@ -51,6 +52,12 @@ func restore(ctx *gb.Context) error {
dst := filepath.Join(ctx.Projectdir(), "vendor", "src", dep.Importpath)
src := filepath.Join(wc.Dir(), dep.Path)

if _, err := os.Stat(dst); err == nil {
if err := fileutils.RemoveAll(dst); err != nil {
return fmt.Errorf("dependency could not be deleted: %v", err)
}
}

if err := fileutils.Copypath(dst, src); err != nil {
return err
}
Expand Down

0 comments on commit fd27784

Please sign in to comment.