mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-11 00:40:00 +08:00
feat: support goctl --module to set go module (#5135)
This commit is contained in:
@@ -46,6 +46,8 @@ var (
|
||||
VarBoolMultiple bool
|
||||
// VarBoolClient describes whether to generate rpc client
|
||||
VarBoolClient bool
|
||||
// VarStringModule describes the module name for go.mod.
|
||||
VarStringModule string
|
||||
)
|
||||
|
||||
// RPCNew is to generate rpc greet service, this greet service can speed
|
||||
@@ -91,6 +93,7 @@ func RPCNew(_ *cobra.Command, args []string) error {
|
||||
ctx.Output = filepath.Dir(src)
|
||||
ctx.ProtocCmd = fmt.Sprintf("protoc -I=%s %s --go_out=%s --go-grpc_out=%s", filepath.Dir(src), filepath.Base(src), filepath.Dir(src), filepath.Dir(src))
|
||||
ctx.IsGenClient = VarBoolClient
|
||||
ctx.Module = VarStringModule
|
||||
|
||||
grpcOptList := VarStringSliceGoGRPCOpt
|
||||
if len(grpcOptList) > 0 {
|
||||
|
||||
@@ -103,6 +103,7 @@ func ZRPC(_ *cobra.Command, args []string) error {
|
||||
ctx.Output = zrpcOut
|
||||
ctx.ProtocCmd = strings.Join(protocArgs, " ")
|
||||
ctx.IsGenClient = VarBoolClient
|
||||
ctx.Module = VarStringModule
|
||||
g := generator.NewGenerator(style, verbose)
|
||||
return g.Generate(&ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user