Skip to content

Commit

Permalink
Use configured SrcFs when DestFs is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
nhatthm committed May 6, 2021
1 parent 2edc8b1 commit 9a4ad3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions test_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 2 additions & 0 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ func must(err error) {
panic(err)
}
}

func ignore(error) {}

0 comments on commit 9a4ad3e

Please sign in to comment.