Skip to content

Use fs.FS for filesystem access #8

@joonas-fi

Description

@joonas-fi

Go's new FS interface is pretty cool, I've used in quite a few projects to serve files embedded into the binary, to do overlayFS-like stuff (merge multiple directories as one) etc. fs.FS enables all of this craziness.

My proposal: instead of giving direct filesystem path like /my/path to a module, the module would take in fs.FS and you could give in os.DirFS("/my/path").

I am willing to send a PR if you are interested. I have not read through the server code to check if there are any requirements that don't have direct analogies in fs interfaces. uid/gid things in Stat() calls would be one thing not present in fs.FileInfo. Those cases would need to be type-switched on (check if stat result is a structure that actually carries uid/gid)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions