Documentation
¶
Overview ¶
Package fsutil holds tiny, dependency-free filesystem helpers shared across the codebase. Currently exports AtomicWriteFile, which replaces the three near-identical copies that lived in internal/claude/jsonpatch.go, internal/migrate/migrate.go, and internal/jsonstrict/jsonstrict.go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWriteFile ¶
AtomicWriteFile writes data to path via a same-directory temp file followed by rename(2), so concurrent readers never observe a half-written file. The temp file's mode is forced to perm before close to override os.CreateTemp's default 0600 — caller intent wins.
Failure cleanup: on any error after the temp file is created, the temp file is removed by the deferred os.Remove. On success the rename consumes the temp path so the deferred remove is a no-op.
Types ¶
This section is empty.