fix(goctl): multi imports the api cause redeclared error in types.go (#3988)

Co-authored-by: Kevin Wan <wanjunfeng@gmail.com>
This commit is contained in:
Jayson Wang
2024-04-04 19:39:24 +08:00
committed by GitHub
parent b20ec8aedb
commit f138cc792e
6 changed files with 98 additions and 12 deletions

View File

@@ -32,11 +32,8 @@ type API struct {
func convert2API(a *ast.AST, importSet map[string]lang.PlaceholderType, is *importstack.ImportStack) (*API, error) {
var api = new(API)
api.importManager = is
api.importSet = make(map[string]lang.PlaceholderType)
api.importSet = importSet
api.Filename = a.Filename
for k, v := range importSet {
api.importSet[k] = v
}
one := a.Stmts[0]
syntax, ok := one.(*ast.SyntaxStmt)
if !ok {