From 3db64c7d473f399d2f23cd0e055520ded5f68c1d Mon Sep 17 00:00:00 2001 From: anqiansong Date: Sat, 29 Oct 2022 22:40:56 +0800 Subject: [PATCH] fix(goctl): Fix #2561 (#2562) * Fix #2561 * format code --- tools/goctl/rpc/cli/cli.go | 6 ++++-- tools/goctl/rpc/cmd.go | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/goctl/rpc/cli/cli.go b/tools/goctl/rpc/cli/cli.go index d7c0fea5..fc1288d3 100644 --- a/tools/goctl/rpc/cli/cli.go +++ b/tools/goctl/rpc/cli/cli.go @@ -104,8 +104,10 @@ func RPCNew(_ *cobra.Command, args []string) error { } // RPCTemplate is the entry for generate rpc template -func RPCTemplate(_ *cobra.Command, _ []string) error { - console.Warning("deprecated: goctl rpc template -o is deprecated and will be removed in the future, use goctl rpc -o instead") +func RPCTemplate(latest bool) error { + if !latest { + console.Warning("deprecated: goctl rpc template -o is deprecated and will be removed in the future, use goctl rpc -o instead") + } protoFile := VarStringOutput home := VarStringHome remote := VarStringRemote diff --git a/tools/goctl/rpc/cmd.go b/tools/goctl/rpc/cmd.go index f948fa2f..6beae0de 100644 --- a/tools/goctl/rpc/cmd.go +++ b/tools/goctl/rpc/cmd.go @@ -10,7 +10,9 @@ var ( Cmd = &cobra.Command{ Use: "rpc", Short: "Generate rpc code", - RunE: cli.RPCTemplate, + RunE: func(cmd *cobra.Command, args []string) error { + return cli.RPCTemplate(true) + }, } newCmd = &cobra.Command{ @@ -23,7 +25,9 @@ var ( templateCmd = &cobra.Command{ Use: "template", Short: "Generate proto template", - RunE: cli.RPCTemplate, + RunE: func(cmd *cobra.Command, args []string) error { + return cli.RPCTemplate(false) + }, } protocCmd = &cobra.Command{