mirror of
https://github.com/bazel-contrib/bazel-lib
synced 2024-11-27 17:43:27 +00:00
3c121a9cd9
* perf: use darwin's clonefile syscall This saves time and disk-space when copying files around on the same device. File clones (aka reflinks) share backing disk blocks; they differ from hardlinks in that inodes are not shared and the contents are copy-on-write. The Go standard library (as of v1.22) arranges to do a similar thing for file copies on Linux (see: https://cs.opensource.google/go/go/+/refs/tags/go1.22.6:src/os/zero_copy_linux.go;l=53). Unfortunately, Mac OS' more limited API is less amenable to that form of transparent wrapping. * Assign to named return params and use naked returns
10 lines
138 B
Go
10 lines
138 B
Go
//go:build !darwin
|
|
|
|
package common
|
|
|
|
func cloneFile(src, dst string) (supported bool, err error) {
|
|
supported = false
|
|
err = nil
|
|
return
|
|
}
|