From 9a4ad3e380048da3ee689d021ddbe81b27afffa1 Mon Sep 17 00:00:00 2001 From: nhatthm Date: Thu, 6 May 2021 14:00:15 +0200 Subject: [PATCH] Use configured SrcFs when DestFs is not set --- copy.go | 2 +- test_setup.go | 3 +++ util.go | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/copy.go b/copy.go index c20ae64..20800b7 100644 --- a/copy.go +++ b/copy.go @@ -272,7 +272,7 @@ func assure(src, dest string, opts ...Options) Options { } if opts[0].DestFs == nil { - opts[0].DestFs = defaults.DestFs + opts[0].DestFs = opts[0].SrcFs } if opts[0].OnSymlink == nil { diff --git a/test_setup.go b/test_setup.go index 75296de..8cfb37a 100644 --- a/test_setup.go +++ b/test_setup.go @@ -13,6 +13,9 @@ import ( func setup(*testing.M) { fs := afero.NewOsFs() + ignore(fs.Remove("resources/fixtures/data/case11/foo/bar")) + ignore(fs.Remove("resources/fixtures/data/case03/case01")) + must(fs.MkdirAll("resources/test/data.copy", os.ModePerm)) must(fs.Chmod("resources/fixtures/data/case07/dir_0555", 0555)) must(fs.Chmod("resources/fixtures/data/case07/file_0444", 0444)) diff --git a/util.go b/util.go index 11e7a88..a27707e 100644 --- a/util.go +++ b/util.go @@ -5,3 +5,5 @@ func must(err error) { panic(err) } } + +func ignore(error) {}