返回 DeepSeek-Reasonix
move_noreplace_linux.go
根目录 / internal / tool / builtin / move_noreplace_linux.go
1 //go:build linux
2
3 package builtin
4
5 import (
6 "golang.org/x/sys/unix"
7 "os"
8 )
9
10 func renameNoReplace(src, dst string) error {
11 if err := unix.Renameat2(unix.AT_FDCWD, src, unix.AT_FDCWD, dst, unix.RENAME_NOREPLACE); err != nil {
12 return &os.LinkError{Op: "rename", Old: src, New: dst, Err: err}
13 }
14 return nil
15 }
16
16 lines GO