Currently, we accomplish this with a sloppy, heavyweight procedure: loop over the whole fsys we want to prefix, and copy each entry - file content bytes and all - using an fstest.MapFS.
It's a waste of both time and space. i'm not sure how much of a waste, but the implementation oughtn't be so bad that we have to do an exhaustive investigation to decide if it's worth it. Really, we want what Go stdlib has for fs.Sub, just in reverse.
There are some places in the code where we dynamically construct a Go
fs.FS
by injecting a prefix onto another fs.https://github.com/grafana/grafana/blob/121e384fabdf01ca191c5a4da3df82094dd2fce7/pkg/cuectx/ctx.go#L230-L231
Currently, we accomplish this with a sloppy, heavyweight procedure: loop over the whole fsys we want to prefix, and copy each entry - file content bytes and all - using an
fstest.MapFS
.It's a waste of both time and space. i'm not sure how much of a waste, but the implementation oughtn't be so bad that we have to do an exhaustive investigation to decide if it's worth it. Really, we want what Go stdlib has for
fs.Sub
, just in reverse.