Chore: Update ast to dst (#61469)
* Update ast to dst * Sort imports * Update thema * Update pkg/codegen/util_go.go Co-authored-by: sam boyer <sdboyer@grafana.com> * Move DecoderCompactor into ApplyFuncs * Remove unnecessary file * Use dst decorator * Downgrade parca-dev library Co-authored-by: sam boyer <sdboyer@grafana.com>
This commit is contained in:
@@ -8,19 +8,19 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"cuelang.org/go/cue/cuecontext"
|
||||
"github.com/dave/dst"
|
||||
"github.com/dave/dst/dstutil"
|
||||
"github.com/grafana/codejen"
|
||||
"github.com/grafana/grafana/pkg/codegen"
|
||||
"github.com/grafana/grafana/pkg/cuectx"
|
||||
"github.com/grafana/thema"
|
||||
"github.com/grafana/thema/encoding/gocode"
|
||||
"github.com/grafana/thema/encoding/jsonschema"
|
||||
"golang.org/x/tools/go/ast/astutil"
|
||||
)
|
||||
|
||||
var dirPlugindef = filepath.Join("pkg", "plugins", "plugindef")
|
||||
@@ -62,7 +62,7 @@ func (j *jennytypego) JennyName() string {
|
||||
}
|
||||
|
||||
func (j *jennytypego) Generate(lin thema.Lineage) (*codejen.File, error) {
|
||||
f, err := codegen.GoTypesJenny{ApplyFuncs: []astutil.ApplyFunc{
|
||||
f, err := codegen.GoTypesJenny{ApplyFuncs: []dstutil.ApplyFunc{
|
||||
codegen.PrefixReplacer("Plugindef", "PluginDef"),
|
||||
}}.Generate(codegen.SchemaForGen{
|
||||
Name: "PluginDef",
|
||||
@@ -85,7 +85,7 @@ func (j *jennybindgo) JennyName() string {
|
||||
func (j *jennybindgo) Generate(lin thema.Lineage) (*codejen.File, error) {
|
||||
b, err := gocode.GenerateLineageBinding(lin, &gocode.BindingConfig{
|
||||
TitleName: "PluginDef",
|
||||
Assignee: ast.NewIdent("*PluginDef"),
|
||||
Assignee: dst.NewIdent("*PluginDef"),
|
||||
PrivateFactory: true,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -46,7 +46,6 @@ func doLineage(rt *thema.Runtime, opts ...thema.BindOption) (thema.ConvergentLin
|
||||
}
|
||||
return tsch.ConvergentLineage(), nil
|
||||
}
|
||||
|
||||
func baseLineage(rt *thema.Runtime, opts ...thema.BindOption) (thema.Lineage, error) {
|
||||
// First, we must get the bytes of the .cue file(s) in which the "plugindef" lineage
|
||||
// is declared, and load them into a
|
||||
|
||||
@@ -67,6 +67,7 @@ const (
|
||||
)
|
||||
|
||||
// Defines values for Category.
|
||||
// Defines values for PlugindefCategory.
|
||||
const (
|
||||
CategoryCloud Category = "cloud"
|
||||
|
||||
@@ -86,6 +87,7 @@ const (
|
||||
)
|
||||
|
||||
// Defines values for Type.
|
||||
// Defines values for PlugindefType.
|
||||
const (
|
||||
TypeApp Type = "app"
|
||||
|
||||
@@ -358,6 +360,7 @@ type URLParam struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// Plugindef defines model for plugindef.
|
||||
// PluginDef defines model for plugindef.
|
||||
type PluginDef struct {
|
||||
// For data source plugins, if the plugin supports alerting.
|
||||
|
||||
Reference in New Issue
Block a user