-
Notifications
You must be signed in to change notification settings - Fork 1k
dep: update calculatePrune to not assume "/" as file separator #780
dep: update calculatePrune to not assume "/" as file separator #780
Conversation
Add a test for dep.calculatePrune Signed-off-by: Ibrahim AshShohail <[email protected]>
0c1c8ea
to
07d30f6
Compare
I didn't look deep in the code, but maybe it should call |
07d30f6
to
a9cd3d8
Compare
Actually, the |
05e9e87
to
0016724
Compare
@darkowlzz I think we can merge this now. But I'll like another pair of eyes to ensure I didn't miss anything. 😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see test for calculatePrune
.
I don't see anything missing. Just little improvement in the test failure text 👍
txn_writer_test.go
Outdated
} | ||
|
||
if !reflect.DeepEqual(want, got) { | ||
t.Fatalf("expected %s, got %s", want, got) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this more informative. Previously, I used to do the same but Sam asked me to make the failures more informative. Something like:
t.Fatalf("Calculated prune paths are not as expected: \n\t(GOT) %v\n\t(WNT) %v", got, want)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes total sense. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the tabs since they are not needed here. An error would like this now:
--- FAIL: TestCalculatePrune (0.00s)
txn_writer_test.go:602: calculated prune paths are not as expected.
(WNT) [/private/var/folders/hb/pdqmtgn954zbj319w8djtncr0000gn/T/gotest236842704/vendor/github.com/prune/pkg/sub /private/var/folders/hb/pdqmtgn954zbj319w8djtncr0000gn/T/gotest236842704/vendor/github.com/prune/pkg]
(GOT) [/private/var/folders/hb/pdqmtgn954zbj319w8djtncr0000gn/T/gotest236842704/vendor/github.com/prune/pkg/sub /private/var/folders/hb/pdqmtgn954zbj319w8djtncr0000gn/T/gotest236842704/vendor/github.com/prune/pkg /private/var/folders/hb/pdqmtgn954zbj319w8djtncr0000gn/T/gotest236842704/vendor/github.com/prune]
2383dce
to
a2f09dc
Compare
AppVeyor is stuck again. 😞 |
dep.calculatePrune assumes "/" is the file separtor. This change fixes an issue caused by that on Windows. Fixes golang#775 Signed-off-by: Ibrahim AshShohail <[email protected]>
a2f09dc
to
30ba901
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ready 👍
What does this do / why do we need it?
As reported in #775 ,
dep prune
deletes all directories invendor
. After digging in, the culpirt seems to becalculatePrune
intxn_writer.go
.This line assume all paths use
/
as a separator. And therefore, causes this check to be alwaystrue
(on filesystems that don't use/
) thus adding all directories to thetoDelete
slice.What should your reviewer look out for in this PR?
Generic review.
Which issue(s) does this PR fix?
fixes #775