-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Replace Afero with fs.FS #1055
Comments
Hi, I could take a look into this, although I didn't use fs.FS much yet. I think we can figure something out :). The first issue I can see is that fs.FS does not provide abstraction for writing to files. Another issue is that fstest.MapFS from stdlib that could be used in unit tests also has some limitations and I think would require some extension to work for viper. I can post a PR soon. |
@uruun thanks, but I don’t think we can realistically get rid of Afero at this point. As you also pointed out, write support is rather poor in io/fs. Let’s hold off on this for now. |
hello, is there any updates with this replacement since there is embed directive feature? |
It's not going to happen in the short term due to the reasons above. But you can use fs.FS through Afero's bridge if that's what you want. It's outlined in their documentation. |
Is your feature request related to a problem? Please describe.
Afero is yet another dependency that Viper needs, but it's not really used to its full potential. I haven't seen anyone replacing the OS filesystem.
Describe the solution you'd like to see
Go 1.16 is going to ship a filesystem abstraction.
We should use it instead.
Describe alternatives you've considered
Come up with a simpler interface, owned by Viper, preferably modeling the new
fs.FS
interfaces..Additional context
This would be a breaking change and would make Go 1.16 a hard requirement. While that might be an issue for some people, Viper 2 will actually make this easier: if #1046 (or a similar concept) gets implemented, we can provide an alternative file loader based on afero for those who need it.
The text was updated successfully, but these errors were encountered: