From 20e659749a9b9dfde0d6acaa1c4c9da5db039cf9 Mon Sep 17 00:00:00 2001 From: chensy <1278651995@qq.com> Date: Sun, 20 Nov 2022 15:23:25 +0800 Subject: [PATCH] fix: fix conflict with the import package name (#2610) Co-authored-by: chenjieping Co-authored-by: Kevin Wan --- tools/goctl/api/parser/parser.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/goctl/api/parser/parser.go b/tools/goctl/api/parser/parser.go index dadfe952..9844b4d6 100644 --- a/tools/goctl/api/parser/parser.go +++ b/tools/goctl/api/parser/parser.go @@ -18,19 +18,19 @@ type parser struct { // Parse parses the api file func Parse(filename string) (*spec.ApiSpec, error) { astParser := ast.NewParser(ast.WithParserPrefix(filepath.Base(filename)), ast.WithParserDebug()) - ast, err := astParser.Parse(filename) + parsedApi, err := astParser.Parse(filename) if err != nil { return nil, err } - spec := new(spec.ApiSpec) - p := parser{ast: ast, spec: spec} + apiSpec := new(spec.ApiSpec) + p := parser{ast: parsedApi, spec: apiSpec} err = p.convert2Spec() if err != nil { return nil, err } - return spec, nil + return apiSpec, nil } func parseContent(content string, skipCheckTypeDeclaration bool, filename ...string) (*spec.ApiSpec, error) { @@ -40,19 +40,19 @@ func parseContent(content string, skipCheckTypeDeclaration bool, filename ...str } else { astParser = ast.NewParser() } - ast, err := astParser.ParseContent(content, filename...) + parsedApi, err := astParser.ParseContent(content, filename...) if err != nil { return nil, err } - spec := new(spec.ApiSpec) - p := parser{ast: ast, spec: spec} + apiSpec := new(spec.ApiSpec) + p := parser{ast: parsedApi, spec: apiSpec} err = p.convert2Spec() if err != nil { return nil, err } - return spec, nil + return apiSpec, nil } // ParseContent parses the api content