Fix prefix dropper in Go codegen (#56041)

This commit is contained in:
sam boyer
2022-09-29 12:01:02 -04:00
committed by GitHub
parent 46da77d1a0
commit 59a3e18bb2
4 changed files with 325 additions and 13 deletions
+3 -3
View File
@@ -3,7 +3,6 @@ package codegen
import (
"bytes"
"fmt"
"go/ast"
"go/format"
"go/parser"
"go/token"
@@ -11,12 +10,13 @@ import (
"path/filepath"
"strings"
"golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/imports"
)
type genGoFile struct {
path string
walker ast.Visitor
walker astutil.ApplyFunc
in []byte
}
@@ -30,7 +30,7 @@ func postprocessGoFile(cfg genGoFile) ([]byte, error) {
}
if cfg.walker != nil {
ast.Walk(cfg.walker, gf)
astutil.Apply(gf, cfg.walker, nil)
err = format.Node(buf, fset, gf)
if err != nil {