Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit a9cd3d8

Browse files
committed
dep: update calculatePrune to not assume "/" as separtor
dep.calculatePrune assumes "/" is the file separtor. This change fixes an issue caused by that on Windows. Fixes #775 Signed-off-by: Ibrahim AshShohail <[email protected]>
1 parent 0584d8c commit a9cd3d8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

txn_writer.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ fail:
530530
return failerr
531531
}
532532

533+
// calculatePrune returns the paths of the packages to be deleted from vendorDir.
533534
func calculatePrune(vendorDir string, keep []string, logger *log.Logger) ([]string, error) {
534535
if logger != nil {
535536
logger.Println("Calculating prune. Checking the following packages:")
@@ -547,7 +548,7 @@ func calculatePrune(vendorDir string, keep []string, logger *log.Logger) ([]stri
547548
return nil
548549
}
549550

550-
name := strings.TrimPrefix(path, vendorDir+"/")
551+
name := strings.TrimPrefix(path, vendorDir+string(filepath.Separator))
551552
if logger != nil {
552553
logger.Printf(" %s", name)
553554
}

txn_writer_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,6 @@ func TestCalculatePrune(t *testing.T) {
601601
}
602602

603603
if !reflect.DeepEqual(want, got) {
604-
t.Fatalf("expect %s, got %s", want, got)
604+
t.Fatalf("expected %s, got %s", want, got)
605605
}
606606
}

0 commit comments

Comments
 (0)