Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filesystem.OpenFile returns vfs.File, not *vfs.File #7

Closed
frontierpsycho opened this issue Nov 13, 2015 · 2 comments
Closed

Filesystem.OpenFile returns vfs.File, not *vfs.File #7

frontierpsycho opened this issue Nov 13, 2015 · 2 comments

Comments

@frontierpsycho
Copy link

I was wondering why OpenFile doesn't return a pointer to a File, like its standard library counterpart. I would say that mirroring the standard library as closely as possible makes it a lot less painful to migrate to using vfs as a wrapper.

@blang
Copy link
Owner

blang commented Nov 13, 2015

That's because vfs.File is an interface and os.File is a struct.
For example in vfs.OsFS underneath this interface a *os.File is returned.

@frontierpsycho
Copy link
Author

Ah, thanks. Fair enough. It seems my grasp of the relationship between pointers and interfaces needs some work.

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

No branches or pull requests

2 participants