You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to have an analog of "cp -r" for the Go standard libraries. I needed this function today for storing an archive containing a couple of nested directories, and couldn't find a ready-to-go solution that is correct wrt linux file ownership and permissions. It seems to be a common enough use case (and difficult enough to implement correctly) that it should be in the standard libraries. As it is, I ended up shelling out using os/exec - which is fine for my purposes, but not cross-platform and requires creation of another process, so it's kind of heavy-weight.
The text was updated successfully, but these errors were encountered:
This is a fine function to put into an external package, but I don't see a need for it in the standard library. There are too many different options to make it appropriate for the standard library--see the GNU/Linux cp --preserve option, for example.
I disagree. We needed this functionality today several times. This is a common pattern needed when working with file systems and especially for cross platform use.
I come from a long Ruby background, there is a great FileUtils class, which implements common use cases for file/dir manipulation.
The issue above, even with --preserve option is implemented in pure Ruby and cross platform compatible.
If one was to provide a PR for this functionality for go, would it be accepted?
@jtarchie It's unfortunately generally not useful to hold discussions on closed issues. Very few people see them. The place to discuss things like this is the golang-dev mailing list.
I think the first step would be to write a go-gettable external package. If that is solid and clean, then we can discuss whether it should come into the standard library, or into golang.org/x.
It would be great to have an analog of "cp -r" for the Go standard libraries. I needed this function today for storing an archive containing a couple of nested directories, and couldn't find a ready-to-go solution that is correct wrt linux file ownership and permissions. It seems to be a common enough use case (and difficult enough to implement correctly) that it should be in the standard libraries. As it is, I ended up shelling out using os/exec - which is fine for my purposes, but not cross-platform and requires creation of another process, so it's kind of heavy-weight.
The text was updated successfully, but these errors were encountered: