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
+5 -5
View File
@@ -2,13 +2,13 @@ package codegen
import (
"bytes"
"go/format"
"go/parser"
"go/token"
"testing"
"github.com/dave/dst/decorator"
"github.com/dave/dst/dstutil"
"github.com/matryer/is"
"golang.org/x/tools/go/ast/astutil"
)
func TestPrefixDropper(t *testing.T) {
@@ -276,15 +276,15 @@ type Thing struct {
}
is := is.New(t)
fset := token.NewFileSet()
inf, err := parser.ParseFile(fset, "input.go", item.in, parser.ParseComments)
inf, err := decorator.ParseFile(fset, "input.go", item.in, parser.ParseComments)
if err != nil {
t.Fatal(err)
}
drop := PrefixDropper("Foo")
astutil.Apply(inf, drop, nil)
dstutil.Apply(inf, drop, nil)
buf := new(bytes.Buffer)
err = format.Node(buf, fset, inf)
err = decorator.Fprint(buf, inf)
if err != nil {
t.Fatal(err)
}