Repository navigation
Conversation
Add the iofs package, whose New(loc) presents any vfs.Location as a read-only fs.FS that also implements fs.StatFS, fs.ReadDirFS, fs.ReadFileFS and fs.SubFS. Names are resolved by listing the parent directory through list.Entries, so behavior is the same on every backend. A name that is both a file and a directory is a file. ReadDir streams entries with their listed metadata. The testcontainers module runs fstest.TestFS on mem, os, sftp, azure and s3. gs and ftp are skipped until their Seek defects (#406, #407) are fixed. Refs #408
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an
iofspackage whoseNew(loc)presents anyvfs.Locationas a read-onlyio/fs.FSthat also implementsfs.StatFS,fs.ReadDirFS,fs.ReadFileFSandfs.SubFS. Works withhttp.FileServerFS,template.ParseFS,fs.WalkDirandfs.Glob. Additive, no change to any v7 interface.list.Entries, so behavior is identical on every backend. A name that is both a file and a directory (object stores) is a file, andReadDirlists it once.ReadDirstreams entries with their listed size and modification time.*fs.PathErrorvalues matchingfs.ErrNotExist,fs.ErrInvalidand so on.Testing
memandos, plustesting/fstest.TestFS,http.FileServerFSrange requests, and mock-driven error paths.testcontainersrunsfstest.TestFSonos,mem,sftp,azureands3, and checks file-wins on S3 and Azure.gsandftpare skipped until gs: File.Read does not advance position when data is returned with io.EOF #406 and ftp: File.Seek with io.SeekEnd uses the wrong sign #407 are fixed.Closes #408