support return () syntax (#101)

* rebase upstream

* rebase

* trim no need line

* trim no need line

* trim no need line

* update doc

* remove update

* remove no need

* remove no need

* goctl add jwt support

* goctl add jwt support

* goctl add jwt support

* goctl support import

* goctl support import

* support return ()

* support return ()

* remove pwd for windows not support

* revert

* remove no need

Co-authored-by: kingxt <dream4kingxt@163.com>
master
kingxt 4 years ago committed by GitHub
parent 9277ad77f7
commit 8a470bb6ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -95,11 +95,11 @@ func (p *serviceEntityParser) parseLine(line string, api *spec.ApiSpec, annos []
method := fields[0] method := fields[0]
path := fields[1] path := fields[1]
req := fields[2] req := fields[2]
var returns string var resp string
if stringx.Contains(fields, returnsTag) { if stringx.Contains(fields, returnsTag) {
if fields[len(fields)-1] != returnsTag { if fields[len(fields)-1] != returnsTag {
returns = fields[len(fields)-1] resp = fields[len(fields)-1]
} else { } else {
return defaultErr return defaultErr
} }
@ -113,7 +113,7 @@ func (p *serviceEntityParser) parseLine(line string, api *spec.ApiSpec, annos []
Method: method, Method: method,
Path: path, Path: path,
RequestType: GetType(api, req), RequestType: GetType(api, req),
ResponseType: GetType(api, returns), ResponseType: GetType(api, resp),
}) })
return nil return nil

@ -91,19 +91,13 @@ func Prepare(projectDir string, checkGrpcEnv bool) (*Project, error) {
return nil, err return nil, err
} }
} else { } else {
pwd, err := execx.Run("pwd", projectDir) pwd, err := filepath.Abs(projectDir)
if err != nil { if err != nil {
return nil, err return nil, err
} }
pwd = filepath.Clean(strings.TrimSpace(pwd))
if !strings.HasPrefix(pwd, src) { if !strings.HasPrefix(pwd, src) {
absPath, err := filepath.Abs(projectDir) name = filepath.Clean(filepath.Base(pwd))
if err != nil {
return nil, err
}
name = filepath.Clean(filepath.Base(absPath))
path = projectDir path = projectDir
pkg = name pkg = name
isInGoEnv = false isInGoEnv = false

Loading…
Cancel
Save