cue
cue copied to clipboard
internal/mod/modimports: loading of CUE syntax needs a cache
This up-coming change to modimports (https://cuelang.org/cl/1195280) to make it read packages spread across
multiple directories means that it will be doing redundant work reading and parsing CUE files
in shared parent directories. In the cue/load package, this issue was addressed by adding a cache (see https://cuelang.org/cl/1193678). The modimports code should be changed similarly to use a cache,
possibly shared with the one in cue/load.
One way of doing that might be to add an optional interface to the fs.FS instance passed into modimports
that provides access to parsed syntax trees.