From a9cd3d8602407b50fc2f124bae950062edb67407 Mon Sep 17 00:00:00 2001 From: Ibrahim AshShohail Date: Wed, 21 Jun 2017 03:19:36 +0300 Subject: [PATCH] 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 --- txn_writer.go | 3 ++- txn_writer_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/txn_writer.go b/txn_writer.go index 97d38fe823..43420dc52b 100644 --- a/txn_writer.go +++ b/txn_writer.go @@ -530,6 +530,7 @@ fail: return failerr } +// calculatePrune returns the paths of the packages to be deleted from vendorDir. func calculatePrune(vendorDir string, keep []string, logger *log.Logger) ([]string, error) { if logger != nil { logger.Println("Calculating prune. Checking the following packages:") @@ -547,7 +548,7 @@ func calculatePrune(vendorDir string, keep []string, logger *log.Logger) ([]stri return nil } - name := strings.TrimPrefix(path, vendorDir+"/") + name := strings.TrimPrefix(path, vendorDir+string(filepath.Separator)) if logger != nil { logger.Printf(" %s", name) } diff --git a/txn_writer_test.go b/txn_writer_test.go index a24cd0cadd..0c983fa51b 100644 --- a/txn_writer_test.go +++ b/txn_writer_test.go @@ -601,6 +601,6 @@ func TestCalculatePrune(t *testing.T) { } if !reflect.DeepEqual(want, got) { - t.Fatalf("expect %s, got %s", want, got) + t.Fatalf("expected %s, got %s", want, got) } }