Repository navigation
v0.1.0 — Initial Release
TOCTOU-safe file writes for Go
Initial release providing race-free file writes via xxhash64 fingerprint verification, cross-platform file locking, and atomic rename.
Added
- TOCTOU-safe file writes via xxhash64 fingerprint verification
- Cross-platform file locking (
flockon Unix,LockFileExon Windows) viagofrs/flock - Atomic rename with
.bakbackup of previous content Fingerprinttype ([8]byte) withIsZero()andMatches()methodsFingerprintFile— computes fingerprint from file path (zero-value for nonexistent files)FingerprintFromBytes— computes fingerprint from raw bytesWrite(path, data, fingerprint)— main API with TOCTOU protectionErrConcurrentModificationsentinel error for fingerprint mismatch detection- File permission preservation from existing file (defaults to
0644for new files) - xxhash64 vs SHA-256 benchmarks demonstrating ~11× speed advantage
- Unit tests, permission preservation tests, and concurrent writer contention test
Note: The
.baktwo-rename pattern in this release was later found to be non-atomic. It was fixed in v0.2.0.