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
What we want here is, i think, an entirely separate generator from our existing func Generate(), on the expectation that we're going to want to handle import generation separately from generating the body. This is a necessary outgrowth of our existing type signatures - if we want Generate() to continue taking a cue.Value (and we do), then swimming back upstream from the cue.Value to finding import statements becomes difficult, so we should handle them separately.
This would be a reasonable signature:
typeImportMapperfunc(*ast.ImportSpec) (string, error) // Already in cuetsy, but needs type sig changefuncGenerateImports(imports []*ast.ImportSpec, mapperImportMapper) ([]byte, error) {}
We could, at some later point, add an e.g. func GenerateFile(), which itself would internally call GenerateImports() and Generate(), but for now we can leave it up to the user to put these bits together themselves.
an example of cue import https://github.com/grafana/grafana/blob/main/public/app/plugins/panel/timeseries/models.cue
The text was updated successfully, but these errors were encountered: