Skip to content

memfs-kit v1.0.0

Choose a tag to compare

@github-actions github-actions released this 25 Oct 06:04
· 21 commits to main since this release

The first stable release of memfs-kit, a lightweight in-memory filesystem
built around Go's io/fs interfaces.

Highlights

  • Create and populate a filesystem with New, MkdirAll, and WriteFile, then
    use it with standard fs helpers, templates, and http.FileServer.
  • *FS implements fs.FS and fs.SubFS. Regular file handles support seeking
    and positional reads; directory handles implement fs.ReadDirFile.
  • Writes copy their input, and open handles retain independent content and
    metadata snapshots. Directory entries are sorted and support consistent
    paginated reads.
  • Filesystem operations and individual handle methods support concurrent use.
    Subtree views share the same underlying tree.
  • WithOpenHook can transform regular files or supply content for missing
    paths. Hooks are preserved across subtrees, and directory metadata reflects
    transformed content.
  • Correctness fixes cover locking, file ownership, directory iteration, error
    propagation, hook metadata, and references retained by closed handles.
  • No third-party Go module dependencies.

Installation

Requires Go 1.27.3 or newer.

go get github.com/soulteary/memfs-kit@v1.0.0
import memfs "github.com/soulteary/memfs-kit"

Migration from soulteary/memfs

Change the import path from github.com/soulteary/memfs to
github.com/soulteary/memfs-kit. The package name remains memfs, and ordinary
memfs.New() calls continue to work.

New now accepts variadic options. Code assigning it to an exact
func() *memfs.FS variable needs a wrapper:

newFS := func() *memfs.FS { return memfs.New() }

Review the documented behavior,
hook semantics,
and upstream review
when migrating. Hook callbacks must synchronize their own shared state and
provide stable output when metadata and content are consumed in separate
operations.

Validation

CI covers Linux, macOS, and Windows, with Linux race detection and bounded path
fuzzing. Formatting, module consistency, and go vet checks remain enabled.

The generated release reports record 97.45% statement coverage and a
Go Report Card grade of A+ (94.7%). See the
test report
and quality report.

Licensing

The project uses Apache License 2.0. Code inherited from memfs retains its
BSD-3-Clause license and original notices. See
LICENSE,
the preserved BSD license,
and third-party notices.