// the find
spf13/afero
The Universal Filesystem Abstraction for Go
Afero is a filesystem abstraction layer for Go that lets you swap the backing store — OS disk, in-memory, ZIP/TAR, SFTP, GCS — without changing application code. The primary selling point is testability: inject MemMapFs in tests instead of hitting disk. It predates Go's io/fs by years and has accumulated a meaningful ecosystem of third-party backends.
MemMapFs is genuinely concurrent-safe and fast — tests that would otherwise require temp-dir setup and teardown just work. The compositional filesystem model (CopyOnWriteFs layered over ReadOnlyFs, CacheOnReadFs over a slow backend) is the kind of thing you'd otherwise hand-roll badly. Full io/fs interop via NewIOFS/FromIOFS means you're not locked out of stdlib tooling. The archive backends (ZipFs, TarFs) cover a real pain point: processing uploaded archives without extracting to disk.
The GCS and SFTP backends are still marked experimental after years — they're in separate go.mod modules, which signals they're not really maintained in lockstep with the core. The interface predates io/fs and shows it: Afero.Fs has 11 methods to implement, which is a steep cliff if you want a custom backend and none of the composition helpers apply. CacheOnReadFs has no write-through invalidation — write to the underlying fs outside of Afero and the cache goes stale silently. There's no Azure Blob backend in the official repo at all, only a wanted-contributions note.