From 5e226a30e3848a5f85b0eec435574b30f00ceb33 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Fri, 9 Aug 2019 16:54:19 -0400 Subject: [PATCH] remove panic and hopefully fix windows test --- dir.go | 1 - file_test.go | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dir.go b/dir.go index 4d4b71c..59e0d71 100644 --- a/dir.go +++ b/dir.go @@ -23,7 +23,6 @@ func MkdirAll(p string, perm os.FileMode) error { Name: root, } if _, ok := filesCache.Load(pt); ok { - panic(pt) root = filepath.Dir(root) continue } diff --git a/file_test.go b/file_test.go index d20f009..03527e3 100644 --- a/file_test.go +++ b/file_test.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "strings" "testing" + "time" "github.com/stretchr/testify/require" ) @@ -70,6 +71,11 @@ func Test_File_Write(t *testing.T) { r.NoError(err) r.Equal(int64(1381), sz) + // because windows can't handle the time precisely + // enough, we have to *force* just a smidge of time + // to ensure the two ModTime's are different. + // i know, i hate it too. + time.Sleep(time.Millisecond) r.NoError(f.Close()) r.Equal(int64(1381), fi.Size()) r.NotZero(fi.ModTime())