What version of Go are you using (go version)?

$ go version
go version go1.17 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/Users/elagergren/git/flow/bin"
GOCACHE="/Users/elagergren/Library/Caches/go-build"
GOENV="/Users/elagergren/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/elagergren/gopath/pkg/mod"
GONOPROXY="*.spideroak-ms.com,*.spideroak.com"
GONOSUMDB="*.spideroak-ms.com,*.spideroak.com"
GOOS="darwin"
GOPATH="/Users/elagergren/gopath"
GOPRIVATE="*.spideroak-ms.com,*.spideroak.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/elagergren/git/flow/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/2b/74fz3jhd4wz4vnbf4z7ywzww0000gp/T/go-build1702522330=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Looked in golang.org/x/sys/unix for Renameatx_np.

What did you expect to see?

Renameatx_np.

What did you see instead?

Not Renameatx_np. :)

The use case here is wanting to use RENAME_EXCL.

Comment From: howjmay

Hi I am interested in this issue, but I kinda need more description for it. Does this issue mean I need to implement Renameatx_np under darwin just like how we implement Renameat?

Comment From: ianlancetaylor

Basically, yes. Although of course the argument types are different.

Comment From: gopherbot

Change https://golang.org/cl/361958 mentions this issue: unix: implements RenamexNp and RenameatxNp for darwin

Comment From: zchee

@elagergren-spideroak @HowJMay How about this implementation? (stil WIP) cc @ianlancetaylor

https://golang.org/cl/361958


I found sys package doesn't provide the copyfile.h related functions. Basically, it's Standard C Library copyfile(3), but Apple implements additional features which are APFS filesystem CoW clone. I also planning to implement those.

Comment From: marius-enlock

Hello,

What is the status of this issue? I found a need for the system call renamex_np with the RENAME_SWAP flag

Comment From: ianlancetaylor

The proposed change didn't get reviewed (which may have been my mistake) and it now has a merge conflict.