io/ioutil: Add CopyFile #8868
io/ioutil: Add CopyFile #8868
Comments
I've proposed the following CL for this issue: https://golang.org/cl/152180043 |
CL https://golang.org/cl/152180043 mentions this issue. |
This request seemed to have the right amount of support in the past, but the previous CL was never completed. The current CL at https://golang.org/cl/152180043 incorporates all of the feedback from the previous one at https://golang.org/cl/1758041, but simplifies things a bit. |
New CL posted here: https://go-review.googlesource.com/#/c/1591 |
(That is, assigning to @robpike to own finding a decision, not making it) |
What should be the correct order for the arguments? dst first or src first? On a related note, do we need io/ioutil.MoveFile? |
I hope ioutil.MoveFile use sys.MoveFile on windows. pythonshutil.copyfile(src, dst) javaPath.copy(src, dst, options) perluse File::Copy;
copy(src, dst); rubyFile.copy(src, dst) etcsendfile(output_fd, input_fd, &offset, size) shell$ cp src.txt dst.txt |
Other issues worth considering for this API: File systems on Linux has the SELinux context, POSIX ACL and extended attributes. I don't mean to propose that ioutil.CopyFile should handle all those complexities, but we need to |
I'd also consider simplifying API by removing func CopyFile(src, dst string, perm os.FileMode) error The rationale is that |
I agree
|
@rjeczalik @davecheney The CopyFile function sets the perm to be consistent with WriteFile. |
My take on that is the |
@rjeczalik Ok, I don't feel strongly about CopyFile setting permissions. So we can just remove it. |
Based on the feedback from @robpike in https://go-review.googlesource.com/#/c/1591, it seems that we should not do this in the ioutil package. It's easy enough to write this bit of code when I need it so I'm happy to close this issue. |
Ok, I've abandoned this change here: https://go-review.googlesource.com/#/c/1591. Please feel free to close. |
The text was updated successfully, but these errors were encountered: