You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have a set of CUE files that i'd like to have available for use with CUE's Go API inside a larger program. These files are knowable at compile time, and i'd like to use Go 1.16 new embed and io/fs to make them available within the program. However, i can't take advantage of load.Instances() with embedded files.
Describe the solution you'd like
The simplest thing i can imagine is:
package load
typeConfig {
...// DirFS represents the root of a hierarchical filesystem in which to run the// the build system's query tool that provides information about the packages.// It is an error to specify both Dir and DirFS.// If neither Dir nor DirFS are specified, the tool is run in the current directory.
DirFS fs.ReadDirFS
}
i don't yet know the new io/fs package well enough to know exactly which composition of the fs interfaces would be sufficient for CUE's needs here. I'm also sure that the above simplistic formulation wouldn't work well if the provided FS is below the module root, so some relation between the above and Config.ModuleRoot probably needs to exist.
Describe alternatives you've considered
It's hard to imagine anything simpler here that allows use of io/fs. I could imagine something more elaborate that ends up as part of an approach to querying, but i can't think of a reason why that would be a reason not to support this simpler case.
The text was updated successfully, but these errors were encountered:
Cue wants to align with the supported Go versions, i.e. since Go still supports 1.15 Cue does not want to force Go 1.16 on its users. io/fs is definitely a possibility down the road.
You can use io/fs in your own program, walk the filetree, and add them to load.Config.Overlay.
Originally opened by @sdboyer in cuelang/cue#814
Is your feature request related to a problem? Please describe.
I have a set of CUE files that i'd like to have available for use with CUE's Go API inside a larger program. These files are knowable at compile time, and i'd like to use Go 1.16 new
embed
andio/fs
to make them available within the program. However, i can't take advantage ofload.Instances()
with embedded files.Describe the solution you'd like
The simplest thing i can imagine is:
i don't yet know the new
io/fs
package well enough to know exactly which composition of thefs
interfaces would be sufficient for CUE's needs here. I'm also sure that the above simplistic formulation wouldn't work well if the providedFS
is below the module root, so some relation between the above andConfig.ModuleRoot
probably needs to exist.Describe alternatives you've considered
It's hard to imagine anything simpler here that allows use of
io/fs
. I could imagine something more elaborate that ends up as part of an approach to querying, but i can't think of a reason why that would be a reason not to support this simpler case.The text was updated successfully, but these errors were encountered: