kindsys: Fix loading on windows (#59519)

This commit is contained in:
sam boyer 2022-11-29 19:01:45 -05:00 committed by GitHub
parent 823a40bc85
commit ce0bdb2cd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,11 +8,8 @@ import (
"cuelang.org/go/cue"
"cuelang.org/go/cue/errors"
"github.com/grafana/thema"
tload "github.com/grafana/thema/load"
"github.com/grafana/grafana"
"github.com/grafana/grafana/pkg/cuectx"
"github.com/grafana/thema"
)
// CoreStructuredDeclParentPath is the path, relative to the repository root, where
@ -49,20 +46,14 @@ func loadpFrameworkOnce() {
})
}
var prefix = filepath.Join("/pkg", "kindsys")
func doLoadFrameworkCUE(ctx *cue.Context) (cue.Value, error) {
var v cue.Value
var err error
bi, err := tload.InstancesWithThema(grafana.CueSchemaFS, prefix)
v, err := cuectx.BuildGrafanaInstance(ctx, filepath.Join("pkg", "kindsys"), "kindsys", nil)
if err != nil {
return v, err
}
v = ctx.BuildInstance(bi)
if err = v.Validate(cue.Concrete(false), cue.All()); err != nil {
return cue.Value{}, fmt.Errorf("coremodel framework loaded cue.Value has err: %w", err)
return cue.Value{}, fmt.Errorf("kindsys framework loaded cue.Value has err: %w", err)
}
return v, nil