fsutil

package
v0.1.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2026 License: MIT Imports: 3 Imported by: 0

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

func AtomicWriteFile(path string, data []byte, perm os.FileMode) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL