Skip to content

Commit 743eb36

Browse files
authored
Feat/refactor genrpc (#390)
* feat(jzero): refactor genrpc and genzrpcclient * feat(jzero): refactor genrpc and genzrpcclient
1 parent 8fcdee7 commit 743eb36

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

  • cmd/jzero/internal/command/gen/genrpc

cmd/jzero/internal/command/gen/genrpc/genrpc.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,23 @@ func (jr *JzeroRpc) Gen() (map[string]rpcparser.Proto, error) {
253253

254254
goPackage = fds[0].AsFileDescriptorProto().GetOptions().GetGoPackage()
255255

256-
command += fmt.Sprintf(" --go_opt=M%s=%s", rel, func() string {
257-
if strings.HasPrefix(goPackage, jr.Module) {
258-
return goPackage
259-
}
260-
return filepath.ToSlash(filepath.Join(jr.Module, "internal", goPackage))
261-
}())
256+
command += fmt.Sprintf(" --go_opt=module=%s --go_opt=M%s=%s --go-grpc_opt=module=%s --go-grpc_opt=M%s=%s",
257+
jr.Module,
258+
rel,
259+
func() string {
260+
if strings.HasPrefix(goPackage, jr.Module) {
261+
return goPackage
262+
}
263+
return filepath.ToSlash(filepath.Join(jr.Module, "internal", goPackage))
264+
}(),
265+
jr.Module,
266+
rel,
267+
func() string {
268+
if strings.HasPrefix(goPackage, jr.Module) {
269+
return goPackage
270+
}
271+
return filepath.ToSlash(filepath.Join(jr.Module, "internal", goPackage))
272+
}())
262273
}
263274

264275
if len(config.C.Gen.ProtoInclude) > 0 {

0 commit comments

Comments
 (0)