Exposes writeable filesystem as experimentalsys.FS #1605
Merged
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.
This exposes our internal filesystem as
experimentalsys.FS
, configured withsysfs.FSConfig
. This includes all the features used in the CLI including the following:sysfs.NewDirFS
- likeos.DirFS
sysfs.NewReadFS
- masks write commandssysfs.Adapt
- adapts anfs.FS
Implementors can use one of these or decorate by embedding one. When writing from scratch, embed
UnimplementedFS/File
accordingly.Here's an example of how to use this until it is no longer experimental:
Note: This does not yet expose a general testing framework, but someone can try to do that in another PR. It is tricky for reasons including windows portability which become better when we no longer have to support Go 1.18 (when Go 1.21 is released).
Fixes #1532
Fixes #1013
cc @tobychui who asked for this yesterday at COSCUP