diff --git a/tools/goctl/api/parser/servicestate.go b/tools/goctl/api/parser/servicestate.go index f6baf4cd..a73a67d7 100644 --- a/tools/goctl/api/parser/servicestate.go +++ b/tools/goctl/api/parser/servicestate.go @@ -95,11 +95,11 @@ func (p *serviceEntityParser) parseLine(line string, api *spec.ApiSpec, annos [] method := fields[0] path := fields[1] req := fields[2] - var returns string + var resp string if stringx.Contains(fields, returnsTag) { if fields[len(fields)-1] != returnsTag { - returns = fields[len(fields)-1] + resp = fields[len(fields)-1] } else { return defaultErr } @@ -113,7 +113,7 @@ func (p *serviceEntityParser) parseLine(line string, api *spec.ApiSpec, annos [] Method: method, Path: path, RequestType: GetType(api, req), - ResponseType: GetType(api, returns), + ResponseType: GetType(api, resp), }) return nil diff --git a/tools/goctl/util/project/project.go b/tools/goctl/util/project/project.go index 5cfc690a..b9f0b976 100644 --- a/tools/goctl/util/project/project.go +++ b/tools/goctl/util/project/project.go @@ -91,19 +91,13 @@ func Prepare(projectDir string, checkGrpcEnv bool) (*Project, error) { return nil, err } } else { - pwd, err := execx.Run("pwd", projectDir) + pwd, err := filepath.Abs(projectDir) if err != nil { return nil, err } - pwd = filepath.Clean(strings.TrimSpace(pwd)) if !strings.HasPrefix(pwd, src) { - absPath, err := filepath.Abs(projectDir) - if err != nil { - return nil, err - } - - name = filepath.Clean(filepath.Base(absPath)) + name = filepath.Clean(filepath.Base(pwd)) path = projectDir pkg = name isInGoEnv = false