diff --git a/copy.go b/copy.go index b529dca..2e6bf3d 100644 --- a/copy.go +++ b/copy.go @@ -32,6 +32,7 @@ import ( "io/ioutil" "os" "path/filepath" + "time" ) // Copy copies src to dest, doesn't matter if src is a directory or a file @@ -65,15 +66,15 @@ func filecopy(src, dest string, info os.FileInfo) error { if err = os.Chmod(f.Name(), info.Mode()); err != nil { return err } - if err = os.Chtimes(f.Name(), info.ModTime(), info.ModTime()); err != nil { - return err - } s, err := os.Open(src) if err != nil { return err } defer s.Close() _, err = io.Copy(f, s) + if err = os.Chtimes(f.Name(), time.Now().Local(), info.ModTime()); err != nil { + return err + } return err }