mirror of
https://github.com/bazel-contrib/bazel-lib
synced 2024-11-27 17:43:27 +00:00
24 lines
371 B
Go
24 lines
371 B
Go
//go:build darwin
|
|
|
|
package common
|
|
|
|
import (
|
|
"os"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// https://keith.github.io/xcode-man-pages/clonefile.2.html
|
|
func cloneFile(src, dst string) (supported bool, err error) {
|
|
supported = true
|
|
if err = unix.Clonefile(src, dst, 0); err != nil {
|
|
err = &os.LinkError{
|
|
Op: "clonefile",
|
|
Old: src,
|
|
New: dst,
|
|
Err: err,
|
|
}
|
|
}
|
|
return
|
|
}
|