From ea58a8e61dee31f002a82aad49b60491f80375a7 Mon Sep 17 00:00:00 2001 From: gmhdbjd Date: Wed, 17 Jun 2020 00:57:08 -0400 Subject: [PATCH] print err directly --- dm/ctl/master/check_task.go | 5 ++--- dm/ctl/master/list_member.go | 5 ++--- dm/ctl/master/migrate_relay.go | 3 +-- dm/ctl/master/offline_member.go | 7 +++---- dm/ctl/master/operate_leader.go | 3 +-- dm/ctl/master/operate_source.go | 5 ++--- dm/ctl/master/pause_relay.go | 5 ++--- dm/ctl/master/pause_task.go | 5 ++--- dm/ctl/master/purge_relay.go | 5 ++--- dm/ctl/master/query_error.go | 5 ++--- dm/ctl/master/query_status.go | 7 +++---- dm/ctl/master/resume_relay.go | 5 ++--- dm/ctl/master/resume_task.go | 5 ++--- dm/ctl/master/show_ddl_locks.go | 5 ++--- dm/ctl/master/sql_inject.go | 9 ++++----- dm/ctl/master/sql_replace.go | 7 +++---- dm/ctl/master/sql_skip.go | 5 ++--- dm/ctl/master/start_task.go | 9 ++++----- dm/ctl/master/stop_task.go | 5 ++--- dm/ctl/master/switch_relay_master.go | 5 ++--- dm/ctl/master/unlock_ddl_lock.go | 5 ++--- dm/ctl/master/update_masterconfig.go | 5 ++--- dm/ctl/master/update_relay.go | 5 ++--- dm/ctl/master/update_task.go | 7 +++---- 24 files changed, 54 insertions(+), 78 deletions(-) diff --git a/dm/ctl/master/check_task.go b/dm/ctl/master/check_task.go index 532db370bf..c73fb26fac 100644 --- a/dm/ctl/master/check_task.go +++ b/dm/ctl/master/check_task.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/dm/checker" "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewCheckTaskCmd creates a CheckTask command @@ -44,7 +43,7 @@ func checkTaskFunc(cmd *cobra.Command, _ []string) { } content, err := common.GetFileContent(cmd.Flags().Arg(0)) if err != nil { - common.PrintLines("get file content error:\n%v", terror.Message(err)) + common.PrintLines("get file content error:\n%v", err) return } @@ -57,7 +56,7 @@ func checkTaskFunc(cmd *cobra.Command, _ []string) { Task: string(content), }) if err != nil { - common.PrintLines("fail to check task:\n%v", terror.Message(err)) + common.PrintLines("fail to check task:\n%v", err) return } diff --git a/dm/ctl/master/list_member.go b/dm/ctl/master/list_member.go index 30dd8a2c1c..dc0cbe848b 100644 --- a/dm/ctl/master/list_member.go +++ b/dm/ctl/master/list_member.go @@ -21,7 +21,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) var ( @@ -73,7 +72,7 @@ func listMemberFunc(cmd *cobra.Command, _ []string) { leader, master, worker, err := convertListMemberType(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) } ctx, cancel := context.WithCancel(context.Background()) @@ -88,7 +87,7 @@ func listMemberFunc(cmd *cobra.Command, _ []string) { }) if err != nil { - common.PrintLines("list member failed, error:\n%v", terror.Message(err)) + common.PrintLines("list member failed, error:\n%v", err) return } common.PrettyPrintResponse(resp) diff --git a/dm/ctl/master/migrate_relay.go b/dm/ctl/master/migrate_relay.go index 7c2a94872d..f753df16ba 100644 --- a/dm/ctl/master/migrate_relay.go +++ b/dm/ctl/master/migrate_relay.go @@ -24,7 +24,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" "github.com/pingcap/dm/pkg/log" - "github.com/pingcap/dm/pkg/terror" ) // NewMigrateRelayCmd creates a MigrateRelay command @@ -49,7 +48,7 @@ func migrateRelayFunc(cmd *cobra.Command, _ []string) { binlogName := cmd.Flags().Arg(1) binlogPos, err := strconv.Atoi(cmd.Flags().Arg(2)) if err != nil { - common.PrintLines(terror.Message(err)) + common.PrintLines("%v", err) } ctx, cancel := context.WithCancel(context.Background()) diff --git a/dm/ctl/master/offline_member.go b/dm/ctl/master/offline_member.go index 258f5eadd5..69959cac80 100644 --- a/dm/ctl/master/offline_member.go +++ b/dm/ctl/master/offline_member.go @@ -19,7 +19,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" "github.com/pingcap/errors" "github.com/spf13/cobra" @@ -66,12 +65,12 @@ func offlineMemberFunc(cmd *cobra.Command, _ []string) { offlineType, err := convertOfflineMemberType(cmd) if err != nil { - common.PrintLines("get offline type failed, error:\n%v", terror.Message(err)) + common.PrintLines("get offline type failed, error:\n%v", err) return } name, err := cmd.Flags().GetString("name") if err != nil { - common.PrintLines("get offline name failed, error:\n%v", terror.Message(err)) + common.PrintLines("get offline name failed, error:\n%v", err) return } else if name == "" { common.PrintLines("a member name must be specified") @@ -86,7 +85,7 @@ func offlineMemberFunc(cmd *cobra.Command, _ []string) { Name: name, }) if err != nil { - common.PrintLines("offline member failed, error:\n%v", terror.Message(err)) + common.PrintLines("offline member failed, error:\n%v", err) return } if !resp.Result { diff --git a/dm/ctl/master/operate_leader.go b/dm/ctl/master/operate_leader.go index 75015ca810..9af88bffe8 100644 --- a/dm/ctl/master/operate_leader.go +++ b/dm/ctl/master/operate_leader.go @@ -21,7 +21,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewOperateLeaderCmd creates a OperateLeader command @@ -70,7 +69,7 @@ func operateLeaderFunc(cmd *cobra.Command, _ []string) { Op: op, }) if err != nil { - common.PrintLines("fail to operate leader:\n%v", terror.Message(err)) + common.PrintLines("fail to operate leader:\n%v", err) return } diff --git a/dm/ctl/master/operate_source.go b/dm/ctl/master/operate_source.go index fea4837a1c..ee97cbac6c 100644 --- a/dm/ctl/master/operate_source.go +++ b/dm/ctl/master/operate_source.go @@ -19,7 +19,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" "github.com/spf13/cobra" ) @@ -59,7 +58,7 @@ func operateSourceFunc(cmd *cobra.Command, _ []string) { configFile := cmd.Flags().Arg(1) content, err := common.GetFileContent(configFile) if err != nil { - common.PrintLines("get file content error:\n%v", terror.Message(err)) + common.PrintLines("get file content error:\n%v", err) return } ctx, cancel := context.WithCancel(context.Background()) @@ -77,7 +76,7 @@ func operateSourceFunc(cmd *cobra.Command, _ []string) { Op: op, }) if err != nil { - common.PrintLines("can not update task:\n%v", terror.Message(err)) + common.PrintLines("can not update task:\n%v", err) return } diff --git a/dm/ctl/master/pause_relay.go b/dm/ctl/master/pause_relay.go index 35a5deb39c..f0c4e41965 100644 --- a/dm/ctl/master/pause_relay.go +++ b/dm/ctl/master/pause_relay.go @@ -21,7 +21,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewPauseRelayCmd creates a PauseRelay command @@ -44,7 +43,7 @@ func pauseRelayFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } if len(sources) == 0 { @@ -54,7 +53,7 @@ func pauseRelayFunc(cmd *cobra.Command, _ []string) { resp, err := common.OperateRelay(pb.RelayOp_PauseRelay, sources) if err != nil { - common.PrintLines("can not pause relay unit:\n%v", terror.Message(err)) + common.PrintLines("can not pause relay unit:\n%v", err) return } diff --git a/dm/ctl/master/pause_task.go b/dm/ctl/master/pause_task.go index 449e6a4061..88ec1fdabb 100644 --- a/dm/ctl/master/pause_task.go +++ b/dm/ctl/master/pause_task.go @@ -20,7 +20,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewPauseTaskCmd creates a PauseTask command @@ -44,13 +43,13 @@ func pauseTaskFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } resp, err := common.OperateTask(pb.TaskOp_Pause, name, sources) if err != nil { - common.PrintLines("can not pause task %s:\n%v", name, terror.Message(err)) + common.PrintLines("can not pause task %s:\n%v", name, err) return } diff --git a/dm/ctl/master/purge_relay.go b/dm/ctl/master/purge_relay.go index d2d9463847..d8e290e65c 100644 --- a/dm/ctl/master/purge_relay.go +++ b/dm/ctl/master/purge_relay.go @@ -25,7 +25,6 @@ import ( "github.com/pingcap/dm/dm/command" "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) var ( @@ -64,7 +63,7 @@ func purgeRelayFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - fmt.Println(terror.Message(err)) + common.PrintLines("%v", err) return } if len(sources) == 0 { @@ -146,7 +145,7 @@ func purgeRelayFunc(cmd *cobra.Command, _ []string) { SubDir: subDir, }) if err != nil { - common.PrintLines("can not purge relay log files: \n%s", terror.Message(err)) + common.PrintLines("can not purge relay log files: \n%v", err) return } diff --git a/dm/ctl/master/query_error.go b/dm/ctl/master/query_error.go index ee12b0447e..859b485ed3 100644 --- a/dm/ctl/master/query_error.go +++ b/dm/ctl/master/query_error.go @@ -19,7 +19,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" "github.com/spf13/cobra" ) @@ -45,7 +44,7 @@ func queryErrorFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } @@ -64,7 +63,7 @@ func queryErrorFunc(cmd *cobra.Command, _ []string) { if len(sources) > 0 { common.PrintLines("sources: %v", sources) } - common.PrintLines("error: %s", terror.Message(err)) + common.PrintLines("error: %v", err) return } diff --git a/dm/ctl/master/query_status.go b/dm/ctl/master/query_status.go index 0f308ad10c..d5fc3531e8 100644 --- a/dm/ctl/master/query_status.go +++ b/dm/ctl/master/query_status.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) const stageError = "Error" @@ -61,7 +60,7 @@ func queryStatusFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } @@ -73,13 +72,13 @@ func queryStatusFunc(cmd *cobra.Command, _ []string) { Sources: sources, }) if err != nil { - common.PrintLines("can not query %s task's status(in sources %v):\n%s", taskName, sources, terror.Message(err)) + common.PrintLines("can not query %s task's status(in sources %v):\n%v", taskName, sources, err) return } more, err := cmd.Flags().GetBool("more") if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } diff --git a/dm/ctl/master/resume_relay.go b/dm/ctl/master/resume_relay.go index cfd7a2c658..9de40d7a7d 100644 --- a/dm/ctl/master/resume_relay.go +++ b/dm/ctl/master/resume_relay.go @@ -21,7 +21,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewResumeRelayCmd creates a ResumeRelay command @@ -44,7 +43,7 @@ func resumeRelayFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } if len(sources) == 0 { @@ -54,7 +53,7 @@ func resumeRelayFunc(cmd *cobra.Command, _ []string) { resp, err := common.OperateRelay(pb.RelayOp_ResumeRelay, sources) if err != nil { - common.PrintLines("can not resume relay unit:\n%v", terror.Message(err)) + common.PrintLines("can not resume relay unit:\n%v", err) return } diff --git a/dm/ctl/master/resume_task.go b/dm/ctl/master/resume_task.go index 70a3dc34a6..c9711645eb 100644 --- a/dm/ctl/master/resume_task.go +++ b/dm/ctl/master/resume_task.go @@ -20,7 +20,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewResumeTaskCmd creates a ResumeTask command @@ -44,13 +43,13 @@ func resumeTaskFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } resp, err := common.OperateTask(pb.TaskOp_Resume, name, sources) if err != nil { - common.PrintLines("can not resume task %s:\n%v", name, terror.Message(err)) + common.PrintLines("can not resume task %s:\n%v", name, err) return } diff --git a/dm/ctl/master/show_ddl_locks.go b/dm/ctl/master/show_ddl_locks.go index 1ec231dd2c..e7886669f5 100644 --- a/dm/ctl/master/show_ddl_locks.go +++ b/dm/ctl/master/show_ddl_locks.go @@ -19,7 +19,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" "github.com/spf13/cobra" ) @@ -45,7 +44,7 @@ func showDDLLocksFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } @@ -57,7 +56,7 @@ func showDDLLocksFunc(cmd *cobra.Command, _ []string) { Sources: sources, }) if err != nil { - common.PrintLines("can not show DDL locks for task %s and sources %v:\n%s", taskName, sources, terror.Message(err)) + common.PrintLines("can not show DDL locks for task %s and sources %v:\n%s", taskName, sources, err) return } diff --git a/dm/ctl/master/sql_inject.go b/dm/ctl/master/sql_inject.go index 64a549b94d..de750ea3e2 100644 --- a/dm/ctl/master/sql_inject.go +++ b/dm/ctl/master/sql_inject.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewSQLInjectCmd creates a SQLInject command @@ -45,7 +44,7 @@ func sqlInjectFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } if len(sources) != 1 { @@ -62,13 +61,13 @@ func sqlInjectFunc(cmd *cobra.Command, _ []string) { extraArgs := cmd.Flags().Args()[1:] realSQLs, err := common.ExtractSQLsFromArgs(extraArgs) if err != nil { - common.PrintLines("check sqls err %s", terror.Message(err)) + common.PrintLines("check sqls err %v", err) return } for _, sql := range realSQLs { isDDL, err2 := common.IsDDL(sql) if err2 != nil { - common.PrintLines("check sql err %s", terror.Message(err2)) + common.PrintLines("check sql err %v", err2) return } if !isDDL { @@ -87,7 +86,7 @@ func sqlInjectFunc(cmd *cobra.Command, _ []string) { Source: sources[0], }) if err != nil { - common.PrintLines("can not inject sql:\n%v", terror.Message(err)) + common.PrintLines("can not inject sql:\n%v", err) return } diff --git a/dm/ctl/master/sql_replace.go b/dm/ctl/master/sql_replace.go index 063cb98eb5..aa745c0848 100644 --- a/dm/ctl/master/sql_replace.go +++ b/dm/ctl/master/sql_replace.go @@ -20,7 +20,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" "github.com/spf13/cobra" ) @@ -55,7 +54,7 @@ func sqlReplaceFunc(cmd *cobra.Command, _ []string) { var source string sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } if sharding { @@ -79,7 +78,7 @@ func sqlReplaceFunc(cmd *cobra.Command, _ []string) { extraArgs := cmd.Flags().Args()[1:] realSQLs, err := common.ExtractSQLsFromArgs(extraArgs) if err != nil { - common.PrintLines("check SQLs error: %s", terror.Message(err)) + common.PrintLines("check SQLs error: %v", err) return } @@ -96,7 +95,7 @@ func sqlReplaceFunc(cmd *cobra.Command, _ []string) { Sharding: sharding, }) if err != nil { - common.PrintLines("can not replace SQL:\n%v", terror.Message(err)) + common.PrintLines("can not replace SQL:\n%v", err) return } diff --git a/dm/ctl/master/sql_skip.go b/dm/ctl/master/sql_skip.go index 76ec278f62..719f279250 100644 --- a/dm/ctl/master/sql_skip.go +++ b/dm/ctl/master/sql_skip.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewSQLSkipCmd creates a SQLSkip command @@ -55,7 +54,7 @@ func sqlSkipFunc(cmd *cobra.Command, _ []string) { var source string sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } if sharding { @@ -89,7 +88,7 @@ func sqlSkipFunc(cmd *cobra.Command, _ []string) { Sharding: sharding, }) if err != nil { - common.PrintLines("can not skip SQL:\n%v", terror.Message(err)) + common.PrintLines("can not skip SQL:\n%v", err) return } diff --git a/dm/ctl/master/start_task.go b/dm/ctl/master/start_task.go index 420480413b..2203920786 100644 --- a/dm/ctl/master/start_task.go +++ b/dm/ctl/master/start_task.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/dm/checker" "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewStartTaskCmd creates a StartTask command @@ -45,19 +44,19 @@ func startTaskFunc(cmd *cobra.Command, _ []string) { } content, err := common.GetFileContent(cmd.Flags().Arg(0)) if err != nil { - common.PrintLines("get file content error:\n%v", terror.Message(err)) + common.PrintLines("get file content error:\n%v", err) return } sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } removeMeta, err := cmd.Flags().GetBool("remove-meta") if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } @@ -72,7 +71,7 @@ func startTaskFunc(cmd *cobra.Command, _ []string) { RemoveMeta: removeMeta, }) if err != nil { - common.PrintLines("can not start task:\n%v", terror.Message(err)) + common.PrintLines("can not start task:\n%v", err) return } diff --git a/dm/ctl/master/stop_task.go b/dm/ctl/master/stop_task.go index 6993e91b06..4b82c06274 100644 --- a/dm/ctl/master/stop_task.go +++ b/dm/ctl/master/stop_task.go @@ -20,7 +20,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewStopTaskCmd creates a StopTask command @@ -44,13 +43,13 @@ func stopTaskFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } resp, err := common.OperateTask(pb.TaskOp_Stop, name, sources) if err != nil { - common.PrintLines("can not stop task %s:\n%v", name, terror.Message(err)) + common.PrintLines("can not stop task %s:\n%v", name, err) return } diff --git a/dm/ctl/master/switch_relay_master.go b/dm/ctl/master/switch_relay_master.go index eebd93c4d1..f67469f9b3 100644 --- a/dm/ctl/master/switch_relay_master.go +++ b/dm/ctl/master/switch_relay_master.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewSwitchRelayMasterCmd creates a SwitchRelayMaster command @@ -45,7 +44,7 @@ func switchRelayMasterFunc(cmd *cobra.Command, _ []string) { sources, err := common.GetSourceArgs(cmd) if err != nil { - fmt.Println(terror.Message(err)) + common.PrintLines("%v", err) return } if len(sources) == 0 { @@ -60,7 +59,7 @@ func switchRelayMasterFunc(cmd *cobra.Command, _ []string) { Sources: sources, }) if err != nil { - common.PrintLines("can not switch relay's master server (in sources %v):\n%s", sources, terror.Message(err)) + common.PrintLines("can not switch relay's master server (in sources %v):\n%v", sources, err) return } diff --git a/dm/ctl/master/unlock_ddl_lock.go b/dm/ctl/master/unlock_ddl_lock.go index 12fae8decc..f181ed33e2 100644 --- a/dm/ctl/master/unlock_ddl_lock.go +++ b/dm/ctl/master/unlock_ddl_lock.go @@ -20,7 +20,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" "github.com/spf13/cobra" ) @@ -46,7 +45,7 @@ func unlockDDLLockFunc(cmd *cobra.Command, _ []string) { } owner, err := cmd.Flags().GetString("owner") if err != nil { - fmt.Println(terror.Message(err)) + common.PrintLines("%v", err) return } @@ -60,7 +59,7 @@ func unlockDDLLockFunc(cmd *cobra.Command, _ []string) { forceRemove, err := cmd.Flags().GetBool("force-remove") if err != nil { - fmt.Println(terror.Message(err)) + common.PrintLines("%v", err) return } diff --git a/dm/ctl/master/update_masterconfig.go b/dm/ctl/master/update_masterconfig.go index 322ffe76d4..1ddf9621bf 100644 --- a/dm/ctl/master/update_masterconfig.go +++ b/dm/ctl/master/update_masterconfig.go @@ -19,7 +19,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" "github.com/spf13/cobra" ) @@ -42,7 +41,7 @@ func updateMasterConfigFunc(cmd *cobra.Command, _ []string) { } content, err := common.GetFileContent(cmd.Flags().Arg(0)) if err != nil { - common.PrintLines("get file content error:\n%v", terror.Message(err)) + common.PrintLines("get file content error:\n%v", err) return } @@ -54,7 +53,7 @@ func updateMasterConfigFunc(cmd *cobra.Command, _ []string) { Config: string(content), }) if err != nil { - common.PrintLines("can not update master config:\n%v", terror.Message(err)) + common.PrintLines("can not update master config:\n%v", err) return } diff --git a/dm/ctl/master/update_relay.go b/dm/ctl/master/update_relay.go index a584204d7a..4cb840bf24 100644 --- a/dm/ctl/master/update_relay.go +++ b/dm/ctl/master/update_relay.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewUpdateRelayCmd creates a UpdateRelay command @@ -45,7 +44,7 @@ func updateRelayFunc(cmd *cobra.Command, _ []string) { content, err := common.GetFileContent(cmd.Flags().Arg(0)) if err != nil { - common.PrintLines("get file content error:\n%v", terror.Message(err)) + common.PrintLines("get file content error:\n%v", err) return } @@ -65,7 +64,7 @@ func updateRelayFunc(cmd *cobra.Command, _ []string) { }) if err != nil { - common.PrintLines("can not update relay config:\n%v", terror.Message(err)) + common.PrintLines("can not update relay config:\n%v", err) return } diff --git a/dm/ctl/master/update_task.go b/dm/ctl/master/update_task.go index 2a8108c5bb..6387672320 100644 --- a/dm/ctl/master/update_task.go +++ b/dm/ctl/master/update_task.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/dm/checker" "github.com/pingcap/dm/dm/ctl/common" "github.com/pingcap/dm/dm/pb" - "github.com/pingcap/dm/pkg/terror" ) // NewUpdateTaskCmd creates a UpdateTask command @@ -44,13 +43,13 @@ func updateTaskFunc(cmd *cobra.Command, _ []string) { } content, err := common.GetFileContent(cmd.Flags().Arg(0)) if err != nil { - common.PrintLines("get file content error:\n%v", terror.Message(err)) + common.PrintLines("get file content error:\n%v", err) return } sources, err := common.GetSourceArgs(cmd) if err != nil { - common.PrintLines("%s", terror.Message(err)) + common.PrintLines("%v", err) return } @@ -64,7 +63,7 @@ func updateTaskFunc(cmd *cobra.Command, _ []string) { Sources: sources, }) if err != nil { - common.PrintLines("can not update task:\n%v", terror.Message(err)) + common.PrintLines("can not update task:\n%v", err) return }