Skip to content

v0.7.0

Latest

Choose a tag to compare

@LarsArtmann LarsArtmann released this 23 Nov 01:59
· 3 commits to master since this release

go-atomic-write v0.7.0

No breaking changes — a drop-in upgrade from v0.6.2.

New API: WriteFuncWithPerm

func WriteFuncWithPerm(path string, fn func(io.Writer) error, perm fs.FileMode) error

Streaming atomic writes with an explicit file permission. WriteFunc always inherited the existing file's mode (or the 0o644 default for new files), so streamed exports like a PII journal dump could only land 0644 unless callers chmod'd after the fact — racy, or with a visible wrong-mode window. The new variant creates the staged temp file with the requested mode, so the final file appears atomically with the correct permissions. Parameter order follows the package convention of putting the distinguishing argument last (WriteFuncVerified(path, fn, fp), WriteWithPerm(path, data, perm)).

Fixed: missing parent directories are created on write

Every write entrypoint now runs MkdirAll on the target's parent directory before staging, so a first write into a fresh cache or config directory succeeds instead of failing with no such file or directory at temp-file creation. Found in the wild: two consumer caches silently ENOENT'd on every save for weeks on machines where the deploy unit had not pre-created the directory. Concurrent MkdirAll on the same directory is safe and is exercised by the concurrency tests.

Also in this release

  • Deterministic collision test for the temp-path uniqueness contract (injectable suffix seam; 512 concurrent real writers pinned from both sides).
  • Website: docs now cover both *Perm variants; landing redesign ("the commit ledger"); sitemap postbuild gate.
  • Docs/CI: release + deploy runbooks in CONTRIBUTING; docs-gates battery wired into CI; fleet-bump vendor-sync ordering fix; website CI lockfile drift guard.

Full changelog: see CHANGELOG.md ([0.7.0] - 2026-11-23) or the live changelog at https://atomicwrite.lars.software/changelog