Documentation
¶
Overview ¶
Package atomicfile writes private files without ever leaving a half-written one behind.
Both the config file and the fallback credentials file are rewritten in full on every change. A crash or a full disk part-way through a plain os.WriteFile would truncate the user's projects; writing to a temporary file in the same directory and renaming it over the target makes the swap atomic, so a reader sees either the old file or the new one.
Index ¶
Constants ¶
const ( FileMode = 0o600 DirMode = 0o700 )
File and directory modes. Both files hold credentials or credential-adjacent data, so they are owner-only.
Variables ¶
var ErrNotPrivate = errors.New("file is readable by users other than its owner")
ErrNotPrivate reports a file that others can read. It is advisory: fft warns rather than refuses, because the user may have good reasons and a CLI that bricks itself over a permission bit is worse than one that complains.
Functions ¶
func CheckPrivate ¶
CheckPrivate reports ErrNotPrivate if path is group- or world-accessible. A missing file is fine — there is nothing to leak.
Types ¶
This section is empty.