Feature rpc protoc (#1251)
* code generation by protoc * generate pb by protoc direct * support: grpc code generation by protoc directly * format code * check --go_out & --go-grpc_out * fix typo * Update version * fix typo * optimize: remove deprecated unit test * format code Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
@@ -24,7 +24,8 @@ package {{.filePackage}}
|
||||
import (
|
||||
"context"
|
||||
|
||||
{{.package}}
|
||||
{{.pbPackage}}
|
||||
{{if ne .pbPackage .protoGoPackage}}{{.protoGoPackage}}{{end}}
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
@@ -100,14 +101,15 @@ func (g *DefaultGenerator) GenCall(ctx DirContext, proto parser.Proto, cfg *conf
|
||||
aliasKeys := alias.KeysStr()
|
||||
sort.Strings(aliasKeys)
|
||||
err = util.With("shared").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
"name": callFilename,
|
||||
"alias": strings.Join(aliasKeys, pathx.NL),
|
||||
"head": head,
|
||||
"filePackage": dir.Base,
|
||||
"package": fmt.Sprintf(`"%s"`, ctx.GetPb().Package),
|
||||
"serviceName": stringx.From(service.Name).ToCamel(),
|
||||
"functions": strings.Join(functions, pathx.NL),
|
||||
"interface": strings.Join(iFunctions, pathx.NL),
|
||||
"name": callFilename,
|
||||
"alias": strings.Join(aliasKeys, pathx.NL),
|
||||
"head": head,
|
||||
"filePackage": dir.Base,
|
||||
"pbPackage": fmt.Sprintf(`"%s"`, ctx.GetPb().Package),
|
||||
"protoGoPackage": fmt.Sprintf(`"%s"`, ctx.GetProtoGo().Package),
|
||||
"serviceName": stringx.From(service.Name).ToCamel(),
|
||||
"functions": strings.Join(functions, pathx.NL),
|
||||
"interface": strings.Join(iFunctions, pathx.NL),
|
||||
}, filename, true)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user