Skip to content

feat: add BridgeIOFS adapter and update README#575

Open
spf13 wants to merge 2 commits into
masterfrom
feat/bridge-iofs
Open

feat: add BridgeIOFS adapter and update README#575
spf13 wants to merge 2 commits into
masterfrom
feat/bridge-iofs

Conversation

@spf13

@spf13 spf13 commented Mar 12, 2026

Copy link
Copy Markdown
Owner
  • Add NewBridgeIOFS to import any io/fs.FS as a read-only afero.Fs
  • Add iofsbridge_test.go with full test coverage
  • Update README: bidirectional io/fs bridge section, BridgeIOFS in backend reference table, new embedded assets + CopyOnWrite use case, fix incorrect afero.FromIOFS reference to afero.NewBridgeIOFS

spf13 and others added 2 commits May 7, 2026 14:45
- Add NewBridgeIOFS to import any io/fs.FS as a read-only afero.Fs
- Add iofsbridge_test.go with full test coverage
- Update README: bidirectional io/fs bridge section, BridgeIOFS in
  backend reference table, new embedded assets + CopyOnWrite use case,
  fix incorrect afero.FromIOFS reference to afero.NewBridgeIOFS
- Use errors.Is(err, os.ErrPermission) instead of os.IsPermission(): the
  latter only unwraps *PathError/*LinkError/*SyscallError, not fmt.Errorf-
  wrapped errors, so the existing check always returned false.

- Skip TestBridgeIOFS_FSTestCompliance on Windows: afero.IOFS.Glob uses
  filepath.Match which on Windows treats backslash as a path separator and
  rejects the backslash-escaped character-class patterns (e.g. [\t]) that
  fstest.TestFS generates. This is a pre-existing IOFS adapter limitation,
  consistent with how the existing TestIOFS is skipped.

- Fix TestBridgeIOFS_InterfacesNotSupported: fstest.MapFS files embed a
  bytes.Reader which implements io.Seeker and io.ReaderAt, so the test
  assumption that they don't was wrong. Add BridgeBasicFile/BridgeNonSeekableFS
  mocks that explicitly omit those interfaces.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@spf13 spf13 force-pushed the feat/bridge-iofs branch from 0bcbfa4 to 68e9c69 Compare May 7, 2026 18:50
@spf13 spf13 mentioned this pull request Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants