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

Replace Afero with fs.FS #1055

Open
sagikazarmark opened this issue Dec 23, 2020 · 2 comments
Open

Replace Afero with fs.FS #1055

sagikazarmark opened this issue Dec 23, 2020 · 2 comments
Labels
kind/enhancement New feature or request
Projects

Comments

@sagikazarmark
Copy link
Collaborator

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.

@sagikazarmark sagikazarmark added the kind/enhancement New feature or request label Dec 23, 2020
@sagikazarmark sagikazarmark added this to To do in Viper 2 via automation Dec 23, 2020
Repository owner deleted a comment from github-actions bot Dec 23, 2020
@uruun
Copy link

uruun commented Apr 9, 2024

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.

@sagikazarmark
Copy link
Collaborator Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
Viper 2
  
To do
Development

No branches or pull requests

2 participants