rpc generation fix (#184)

* reactor alert

* optimize

* add test case

* update the target directory in case proto contains option

* fix missing comments and format code
This commit is contained in:
Keson
2020-11-05 19:08:34 +08:00
committed by GitHub
parent f7d778e0ed
commit 856b5aadb1
19 changed files with 97 additions and 36 deletions

View File

@@ -53,8 +53,12 @@ func mkdir(ctx *ctx.ProjectContext, proto parser.Proto) (DirContext, error) {
logicDir := filepath.Join(internalDir, "logic")
serverDir := filepath.Join(internalDir, "server")
svcDir := filepath.Join(internalDir, "svc")
pbDir := filepath.Join(internalDir, proto.GoPackage)
pbDir := filepath.Join(ctx.WorkDir, proto.GoPackage)
callDir := filepath.Join(ctx.WorkDir, strings.ToLower(stringx.From(proto.Service.Name).ToCamel()))
if strings.ToLower(proto.Service.Name) == strings.ToLower(proto.GoPackage) {
callDir = filepath.Join(ctx.WorkDir, strings.ToLower(stringx.From(proto.Service.Name+"_client").ToCamel()))
}
inner[wd] = Dir{
Filename: ctx.WorkDir,
Package: filepath.ToSlash(filepath.Join(ctx.Path, strings.TrimPrefix(ctx.WorkDir, ctx.Dir))),