From b14d2fb5985e6ab92ba480bf864ca51686c8d729 Mon Sep 17 00:00:00 2001 From: valoq Date: Mon, 13 Apr 2026 22:41:44 +0200 Subject: [PATCH] fix: preserve successfully copied files with timestamp failure (#2519) * fix: preserve successfully copied files with timestamp failure * improve error message --- copy.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/copy.go b/copy.go index 835fa938..355b22f6 100644 --- a/copy.go +++ b/copy.go @@ -94,10 +94,6 @@ func copyFile(src, dst string, preserve []string, info os.FileInfo, nums chan<- mtime := info.ModTime() if err := os.Chtimes(dst, atime, mtime); err != nil { errs <- err - if err = os.Remove(dst); err != nil { - errs <- err - } - return } } } @@ -175,7 +171,7 @@ func copyAll(srcs []string, dstDir string, preserve []string) (nums chan int64, atime := times.Get(info).AccessTime() mtime := info.ModTime() if err := os.Chtimes(path, atime, mtime); err != nil { - errs <- fmt.Errorf("chtimes: %w", err) + errs <- err } }