diff --git a/pkg/common/cmd/api.go b/pkg/common/cmd/api.go index 3a2474df8..fdd840bf0 100644 --- a/pkg/common/cmd/api.go +++ b/pkg/common/cmd/api.go @@ -40,7 +40,7 @@ func NewApiCmd() *ApiCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.preRunE() } return ret diff --git a/pkg/common/cmd/auth.go b/pkg/common/cmd/auth.go index cc8cd7ea8..8b76ae2d6 100644 --- a/pkg/common/cmd/auth.go +++ b/pkg/common/cmd/auth.go @@ -41,7 +41,7 @@ func NewAuthRpcCmd() *AuthRpcCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.preRunE() } diff --git a/pkg/common/cmd/conversation.go b/pkg/common/cmd/conversation.go index e70eaf6d0..0a617c729 100644 --- a/pkg/common/cmd/conversation.go +++ b/pkg/common/cmd/conversation.go @@ -44,8 +44,8 @@ func NewConversationRpcCmd() *ConversationRpcCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { - return ret.preRunE() + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { + return ret.runE() } return ret } @@ -54,7 +54,7 @@ func (a *ConversationRpcCmd) Exec() error { return a.Execute() } -func (a *ConversationRpcCmd) preRunE() error { +func (a *ConversationRpcCmd) runE() error { return startrpc.Start(a.ctx, &a.conversationConfig.ZookeeperConfig, &a.conversationConfig.RpcConfig.Prometheus, a.conversationConfig.RpcConfig.RPC.ListenIP, a.conversationConfig.RpcConfig.RPC.RegisterIP, a.conversationConfig.RpcConfig.RPC.Ports, a.Index(), a.conversationConfig.Share.RpcRegisterName.Conversation, &a.conversationConfig.Share, a.conversationConfig, conversation.Start) diff --git a/pkg/common/cmd/cron_task.go b/pkg/common/cmd/cron_task.go index 9f7f5477a..b29cee2ce 100644 --- a/pkg/common/cmd/cron_task.go +++ b/pkg/common/cmd/cron_task.go @@ -42,7 +42,7 @@ func NewCronTaskCmd() *CronTaskCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.preRunE() } return ret diff --git a/pkg/common/cmd/friend.go b/pkg/common/cmd/friend.go index 052498cb0..6ca57c733 100644 --- a/pkg/common/cmd/friend.go +++ b/pkg/common/cmd/friend.go @@ -45,7 +45,7 @@ func NewFriendRpcCmd() *FriendRpcCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.preRunE() } return ret diff --git a/pkg/common/cmd/msg.go b/pkg/common/cmd/msg.go index 696657f64..d90380743 100644 --- a/pkg/common/cmd/msg.go +++ b/pkg/common/cmd/msg.go @@ -46,7 +46,7 @@ func NewMsgRpcCmd() *MsgRpcCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.preRunE() } return ret diff --git a/pkg/common/cmd/msg_gateway.go b/pkg/common/cmd/msg_gateway.go index adad280f3..bda0efaf9 100644 --- a/pkg/common/cmd/msg_gateway.go +++ b/pkg/common/cmd/msg_gateway.go @@ -42,7 +42,7 @@ func NewMsgGatewayCmd() *MsgGatewayCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.preRunE() } return ret diff --git a/pkg/common/cmd/msg_transfer.go b/pkg/common/cmd/msg_transfer.go index ac175b8ec..9e7457fed 100644 --- a/pkg/common/cmd/msg_transfer.go +++ b/pkg/common/cmd/msg_transfer.go @@ -43,7 +43,7 @@ func NewMsgTransferCmd() *MsgTransferCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.preRunE() } return ret diff --git a/pkg/common/cmd/push.go b/pkg/common/cmd/push.go index d7d87b5ed..0dca75fa0 100644 --- a/pkg/common/cmd/push.go +++ b/pkg/common/cmd/push.go @@ -46,7 +46,7 @@ func NewPushRpcCmd() *PushRpcCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.preRunE() } return ret diff --git a/pkg/common/cmd/third.go b/pkg/common/cmd/third.go index 437fee893..5c8e1ed8f 100644 --- a/pkg/common/cmd/third.go +++ b/pkg/common/cmd/third.go @@ -45,7 +45,7 @@ func NewThirdRpcCmd() *ThirdRpcCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.preRunE() } return ret diff --git a/pkg/common/cmd/user.go b/pkg/common/cmd/user.go index 900deb874..cf9b211d3 100644 --- a/pkg/common/cmd/user.go +++ b/pkg/common/cmd/user.go @@ -46,7 +46,7 @@ func NewUserRpcCmd() *UserRpcCmd { } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) ret.ctx = context.WithValue(context.Background(), "version", config.Version) - ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error { + ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.preRunE() } return ret