coremodels: Update to latest Thema with generics (#56602)

* Update thema to latest

* Deal with s/Library/*Runtime/

* Commit new, working results of codegen
This commit is contained in:
sam boyer
2022-10-11 09:45:07 +01:00
committed by GitHub
parent 668cb25b82
commit e5a6547a94
26 changed files with 171 additions and 247 deletions
+4 -4
View File
@@ -10,22 +10,22 @@ import (
"github.com/grafana/thema"
)
func makeTreeOrPanic(path string, pkgname string, lib thema.Library) *pfs.Tree {
func makeTreeOrPanic(path string, pkgname string, rt *thema.Runtime) *pfs.Tree {
sub, err := fs.Sub(grafana.CueSchemaFS, path)
if err != nil {
panic("could not create fs sub to " + path)
}
tree, err := pfs.ParsePluginFS(sub, lib)
tree, err := pfs.ParsePluginFS(sub, rt)
if err != nil {
panic(fmt.Sprintf("error parsing plugin metadata for %s: %s", pkgname, err))
}
return tree
}
func coreTreeList(lib thema.Library) pfs.TreeList{
func coreTreeList(rt *thema.Runtime) pfs.TreeList{
return pfs.TreeList{
{{- range .Plugins }}
makeTreeOrPanic("{{ .Path }}", "{{ .PkgName }}", lib),
makeTreeOrPanic("{{ .Path }}", "{{ .PkgName }}", rt),
{{- end }}
}
}