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:
Selene
2023-01-17 11:58:08 +01:00
committed by GitHub
co-authored by sam boyer
parent 9e097c531d
commit 68f1bfa471
9 changed files with 82 additions and 92 deletions
+4 -4
View File
@@ -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 {