Comments (6)
@jmalloc If we add Symlink
to the billy.Filesystem
interface, we'd need to bump version to v3
. So my proposal would be adding Symlink
function to implementations in v2
, and defer exposing it in billy.Filesystem
.
Mimicking os.Symlink
as much as possible is definitely the way to go. PRs are welcome ;-)
from go-billy.
I have a question about the behaviour of the subdir
filesystem and how best to implement Symlink()
there. First some background; subdir.New()
doesn't create the subdirFs.base
sub-directory on the underlying filesystem. As best I can tell, this doesn't usually present any problem because:
Filesystem.Create()
creates all parent directories when theO_CREATE
flag is set.- There is no
Filesystem.Mkdir()
onlyMkdirAll()
, and hence no way that directory creation can fail just becausesubdirFs.base
does not exist.
This presents a small problem for Symlink()
, which always fails because the base directory is never created. In light of that, should I:
- Create
subdirFs.base
if it does not exist. This most closely mirrors the behaviour of the standard library insofar asSymlink()
will fail if anything deeper thanbase
does not exist. - Create all necessary parent directories in all FS implementations. This more closely mirrors the behaviour of
Filesystem.Create()
.
I'll proceed with option (2) for now to best maintain consistency within Billy's API. Please let me know if some other behaviour is more desirable.
Note: Just like osfs.OS.Create()
, any directories created will remain if symlink creation fails.
As an aside, my comment about not being able to create symlinks to non-existent files with os.Symlink()
appears to be a blatant lie ;)
from go-billy.
@jmalloc SubdirFs should just delegate the Symlink call to the underlying filesystem if it does implement the Symlink function, or return an error otherwise.
Then the underlying filesystem should create directories as needed.
from go-billy.
@jmalloc Are you working on this? Feel free to create a partial PR to get further feedback, we can also help completing it.
from go-billy.
I am. I have implementations for theos
and subdir
filesystems, but I haven't yet found time to complete the memory-based implementation. I'm submit a PR with what I have so far when I get a chance.
from go-billy.
@jmalloc Thank you! We'll review it soon and figure out how to move it forward.
from go-billy.
Related Issues (20)
- there is a maximum global temp file limit on util and memfs HOT 2
- Comparison with afero? HOT 1
- Why is the Change interface not included in Filesystem? HOT 1
- memfs OpenFile does not work on directories HOT 2
- isCrossedBoundary incorrectly identifies path "..foo" as cross boundary
- Plan 9 Support HOT 3
- Improve documentation HOT 1
- TempDir option HOT 1
- osfs should implement billy.Changer HOT 3
- Constructing a `memfs` from an `osfs`. HOT 2
- New release that comes with capabilities interface HOT 3
- Use spf13/afero or provide a compatibility layer? HOT 4
- Dep - Hash Mismatches HOT 1
- Building on Illumos Issue HOT 2
- memfs doesn't handle creating and opening files in directory which is a symlink
- memfs doesn't handle renaming files which share a prefix (e.g foobar.txt and foobar.txt.asc)
- storage.ReadAt doesn't read with empty arrays HOT 1
- billy.CapabilityCheck HOT 1
- memfs: fatal error: concurrent map writes HOT 1
- osfs: does not support chmod? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-billy.