sys/atomic is the original home of the crash-safe WriteFile. It lives in the separate
getarcaneapp/sys repository and is scheduled for removal.
- Module
go.getarcane.app/sys/atomic- Reference
- pkg.go.dev
go get go.getarcane.app/sys/atomic@latestMigrating
Section titled “Migrating”acfs/atomic has the same function signature, so moving over only means
changing the import:
import "go.getarcane.app/sys/atomic"import "go.getarcane.app/acfs/atomic"
err := atomic.WriteFile(path, data, 0o600)Both packages write to a temporary file in the destination’s directory, fsync it, apply the permissions, and rename it into place. Both refuse to write through a symlink, directory, named pipe, socket, or device.