Repository navigation
v0.4.0
⚠️ Breaking API split (source-incompatible)
The previous Write(path, data, fingerprint) mixed two distinct intents behind a zero-value Fingerprint{}, which silently skipped TOCTOU verification (a footgun). The API is now split by intent:
Write(path, data)/WriteFunc(path, fn)— plain atomic write, no TOCTOU check (the common case).WriteVerified(path, data, fingerprint)/WriteFuncVerified(path, fn, fingerprint)— atomic write WITH fingerprint verification. A zero-value fingerprint here means "the file must NOT already exist" — a concurrent creation is treated as a conflict and fails, rather than being silently ignored.
This is a source-incompatible change for 0.x (hence the minor bump). All in-repo consumers were updated.
Migration
| Before | After |
|---|---|
Write(path, data, Fingerprint{}) |
Write(path, data) |
Write(path, data, fp) (real fingerprint) |
WriteVerified(path, data, fp) |
WriteFunc(path, fn, Fingerprint{}) |
WriteFunc(path, fn) |
WriteFunc(path, fn, fp) (real fingerprint) |
WriteFuncVerified(path, fn, fp) |
✨ Added
WriteIfChanged(path, data) (changed bool, err error)— writes only if content differs from disk. Returnschanged=truewhen the file was written,falsewhen skipped (identical content). The idiomatic primitive for config-file writers and code generators that must not produce spurious diffs on re-runs: no content change means no file mutation, no mtime bump, no file-watcher trigger. ComposesFingerprintFile+WriteVerified; first-write uses plainWrite.
📝 Full changelog
See CHANGELOG.md for the complete list of changes in this release, including website, documentation, accessibility, and CI improvements.