From 97789ed48aefc4ff8811c4627a3804618086fc1d Mon Sep 17 00:00:00 2001 From: Yujie Xia Date: Thu, 13 Oct 2022 14:42:51 +0800 Subject: [PATCH] *: add gci to format imports --- .golangci.yml | 3 +- Makefile | 6 ++-- cdc/api/owner/owner.go | 7 ++--- cdc/entry/schema/snapshot.go | 7 ++--- cdc/entry/schema_storage_test.go | 5 ++- cdc/http.go | 4 +-- cdc/owner/status_provider.go | 3 +- cdc/processor/pipeline/sink.go | 3 +- cdc/processor/pipeline/table_actor_test.go | 5 ++- cdc/redo/common/util_test.go | 3 +- cdc/redo/writer/file.go | 11 +++---- cdc/redo/writer/file_test.go | 5 ++- .../internal/v2/processor_agent_test.go | 11 +++---- cdc/server/server.go | 21 ++++++------- cdc/server/server_test.go | 13 ++++---- cdc/sink/mysql/causality.go | 3 +- cdc/sink/mysql/mysql.go | 7 ++--- cdc/sink/mysql/mysql_worker.go | 7 ++--- cmd/dm-master/main.go | 3 +- cmd/dm-syncer/config.go | 1 - cmd/dm-syncer/main.go | 5 ++- cmd/dm-worker/main.go | 3 +- cmd/dm-worker/main_test.go | 1 - dm/_utils/terror_gen/checker_template.go | 1 - dm/chaos/cases/cases.go | 3 +- dm/chaos/cases/db.go | 3 +- dm/chaos/cases/diff.go | 3 +- dm/chaos/cases/main.go | 5 ++- dm/chaos/cases/task.go | 5 ++- dm/checker/check_test.go | 3 +- dm/checker/checker.go | 13 ++++---- dm/config/source_config.go | 6 ++-- dm/config/source_config_test.go | 3 +- dm/config/source_converter_test.go | 1 - dm/config/subtask.go | 3 +- dm/config/task.go | 5 ++- dm/config/task_converters.go | 3 +- dm/config/task_converters_test.go | 3 +- dm/config/task_test.go | 4 +-- dm/ctl/common/config.go | 8 ++--- dm/ctl/common/util.go | 13 ++++---- dm/ctl/ctl.go | 5 ++- dm/ctl/master/binlog.go | 1 - dm/ctl/master/check_task.go | 5 ++- dm/ctl/master/config.go | 5 ++- dm/ctl/master/get_config.go | 3 +- dm/ctl/master/handle_error.go | 3 +- dm/ctl/master/list_member.go | 3 +- dm/ctl/master/offline_member.go | 3 +- dm/ctl/master/operate_leader.go | 3 +- dm/ctl/master/operate_schema.go | 3 +- dm/ctl/master/operate_source.go | 5 ++- dm/ctl/master/operate_task.go | 3 +- dm/ctl/master/operate_validation.go | 3 +- dm/ctl/master/pause_relay.go | 3 +- dm/ctl/master/pause_task.go | 3 +- dm/ctl/master/purge_relay.go | 3 +- dm/ctl/master/query_status.go | 3 +- dm/ctl/master/query_status_test.go | 3 +- dm/ctl/master/query_validation.go | 4 +-- dm/ctl/master/resume_relay.go | 3 +- dm/ctl/master/resume_task.go | 3 +- dm/ctl/master/show_ddl_locks.go | 1 - dm/ctl/master/source_table_schema.go | 1 - dm/ctl/master/start_stop_relay.go | 1 - dm/ctl/master/start_stop_validation.go | 3 +- dm/ctl/master/start_task.go | 5 ++- dm/ctl/master/stop_task.go | 3 +- dm/ctl/master/transfer_source.go | 1 - dm/ctl/master/unlock_ddl_lock.go | 1 - .../binlog-event-blackhole/fetcher.go | 3 +- dm/debug-tools/binlog-event-blackhole/main.go | 3 +- dm/dumpling/dumpling.go | 9 +++--- dm/dumpling/dumpling_test.go | 7 ++--- dm/loader/checkpoint.go | 3 +- dm/loader/checkpoint_test.go | 3 +- dm/loader/convert_data.go | 7 ++--- dm/loader/convert_data_test.go | 4 +-- dm/loader/db.go | 3 +- dm/loader/lightning.go | 13 ++++---- dm/loader/loader.go | 14 ++++----- dm/loader/status.go | 3 +- dm/loader/status_test.go | 3 +- dm/loader/util.go | 5 ++- dm/master/agent_pool.go | 1 - dm/master/bootstrap.go | 3 +- dm/master/bootstrap_test.go | 1 - dm/master/config.go | 5 ++- dm/master/config_test.go | 3 +- dm/master/election.go | 5 ++- dm/master/election_test.go | 5 ++- dm/master/etcd.go | 7 ++--- dm/master/etcd_test.go | 7 ++--- dm/master/http_handler.go | 3 +- dm/master/openapi_controller.go | 11 +++---- dm/master/openapi_controller_test.go | 3 +- dm/master/openapi_view.go | 3 +- dm/master/openapi_view_test.go | 7 ++--- dm/master/scheduler/scheduler.go | 7 ++--- dm/master/scheduler/scheduler_test.go | 11 +++---- dm/master/scheduler/worker.go | 3 +- dm/master/scheduler/worker_test.go | 3 +- dm/master/server.go | 11 +++---- dm/master/server_test.go | 11 +++---- dm/master/shardddl/info_test.go | 3 +- dm/master/shardddl/optimist.go | 5 ++- dm/master/shardddl/optimist_test.go | 9 +++--- dm/master/shardddl/pessimist.go | 6 ++-- dm/master/shardddl/pessimist_test.go | 11 +++---- dm/master/workerrpc/rawgrpc.go | 7 ++--- dm/master/workerrpc/workerrpc_test.go | 3 +- dm/pkg/backoff/backoff_test.go | 1 - dm/pkg/binlog/event/common.go | 1 - dm/pkg/binlog/event/common_test.go | 1 - dm/pkg/binlog/event/ddl.go | 1 - dm/pkg/binlog/event/ddl_test.go | 1 - dm/pkg/binlog/event/dml.go | 1 - dm/pkg/binlog/event/dml_test.go | 1 - dm/pkg/binlog/event/event.go | 1 - dm/pkg/binlog/event/event_test.go | 1 - dm/pkg/binlog/event/generator.go | 1 - dm/pkg/binlog/event/generator_test.go | 1 - dm/pkg/binlog/event/helper.go | 1 - dm/pkg/binlog/event/helper_test.go | 1 - dm/pkg/binlog/event/sid_mysql.go | 1 - dm/pkg/binlog/event/util.go | 3 +- dm/pkg/binlog/event/util_test.go | 3 +- dm/pkg/binlog/file.go | 3 +- dm/pkg/binlog/pos_finder.go | 3 +- dm/pkg/binlog/pos_finder_test.go | 1 - dm/pkg/binlog/position.go | 3 +- dm/pkg/binlog/position_test.go | 1 - dm/pkg/binlog/reader/file.go | 5 ++- dm/pkg/binlog/reader/file_test.go | 1 - dm/pkg/binlog/reader/tcp.go | 4 +-- dm/pkg/binlog/reader/tcp_test.go | 1 - dm/pkg/binlog/reader/util.go | 3 +- dm/pkg/binlog/status.go | 1 - dm/pkg/binlog/status_test.go | 3 +- dm/pkg/checker/binlog.go | 1 - dm/pkg/checker/binlog_test.go | 3 +- dm/pkg/checker/mysql_server.go | 1 - dm/pkg/checker/onlineddl.go | 1 - dm/pkg/checker/privilege.go | 3 +- dm/pkg/checker/table_structure.go | 6 ++-- dm/pkg/conn/baseconn.go | 5 ++- dm/pkg/conn/basedb.go | 3 +- dm/pkg/conn/basedb_test.go | 8 ++--- dm/pkg/conn/mockdb.go | 3 +- dm/pkg/conn/utils.go | 3 +- dm/pkg/conn/utils_test.go | 3 +- dm/pkg/dumpling/utils.go | 3 +- dm/pkg/dumpling/utils_test.go | 1 - dm/pkg/election/election.go | 5 ++- dm/pkg/election/election_test.go | 7 ++--- dm/pkg/etcdutil/etcdutil.go | 11 +++---- dm/pkg/etcdutil/etcdutil_test.go | 5 ++- dm/pkg/func-rollback/rollback.go | 1 - dm/pkg/gtid/gtid.go | 1 - dm/pkg/ha/bound.go | 7 ++--- dm/pkg/ha/bound_test.go | 3 +- dm/pkg/ha/keepalive.go | 7 ++--- dm/pkg/ha/keepalive_test.go | 3 +- dm/pkg/ha/load_task.go | 5 ++- dm/pkg/ha/openapi_task_config.go | 5 ++- dm/pkg/ha/openapi_task_config_test.go | 1 - dm/pkg/ha/ops.go | 5 ++- dm/pkg/ha/ops_test.go | 1 - dm/pkg/ha/relay.go | 7 ++--- dm/pkg/ha/relay_test.go | 3 +- dm/pkg/ha/source.go | 3 +- dm/pkg/ha/source_test.go | 3 +- dm/pkg/ha/stage.go | 7 ++--- dm/pkg/ha/stage_test.go | 1 - dm/pkg/ha/subtask.go | 3 +- dm/pkg/ha/subtask_test.go | 1 - dm/pkg/ha/task_cli_args.go | 3 +- dm/pkg/ha/task_cli_args_test.go | 1 - dm/pkg/ha/worker.go | 3 +- dm/pkg/log/log.go | 5 ++- dm/pkg/log/log_test.go | 5 ++- dm/pkg/parser/common.go | 10 +++--- dm/pkg/parser/common_test.go | 3 +- dm/pkg/retry/errors.go | 1 - dm/pkg/retry/strategy.go | 1 - dm/pkg/retry/strategy_test.go | 5 ++- dm/pkg/schema/tracker.go | 5 ++- dm/pkg/shardddl/optimism/column.go | 3 +- dm/pkg/shardddl/optimism/info.go | 5 ++- dm/pkg/shardddl/optimism/info_test.go | 5 ++- dm/pkg/shardddl/optimism/keeper_test.go | 3 +- dm/pkg/shardddl/optimism/lock.go | 7 ++--- dm/pkg/shardddl/optimism/lock_test.go | 3 +- dm/pkg/shardddl/optimism/operation.go | 7 ++--- dm/pkg/shardddl/optimism/ops.go | 3 +- dm/pkg/shardddl/optimism/table.go | 5 ++- dm/pkg/shardddl/pessimism/info.go | 7 ++--- dm/pkg/shardddl/pessimism/info_test.go | 5 ++- dm/pkg/shardddl/pessimism/lock_test.go | 1 - dm/pkg/shardddl/pessimism/operation.go | 5 ++- dm/pkg/shardddl/pessimism/ops.go | 3 +- dm/pkg/storage/utils.go | 5 ++- dm/pkg/upgrade/upgrade.go | 5 ++- dm/pkg/upgrade/upgrade_test.go | 3 +- dm/pkg/upgrade/version.go | 3 +- dm/pkg/utils/common.go | 3 +- dm/pkg/utils/common_test.go | 3 +- dm/pkg/utils/db.go | 3 +- dm/pkg/utils/db_test.go | 3 +- dm/pkg/utils/encrypt_test.go | 1 - dm/pkg/utils/file.go | 3 +- dm/pkg/utils/file_test.go | 1 - dm/pkg/utils/filename.go | 3 +- dm/pkg/utils/relay.go | 1 - dm/pkg/utils/storage_freebsd.go | 3 +- dm/pkg/utils/storage_unix.go | 3 +- dm/pkg/utils/time.go | 1 - dm/pkg/utils/util.go | 5 ++- dm/pkg/v1dbschema/schema.go | 3 +- dm/pkg/v1dbschema/schema_test.go | 1 - dm/pkg/v1workermeta/api.go | 1 - dm/pkg/v1workermeta/api_test.go | 1 - dm/pkg/v1workermeta/db.go | 3 +- dm/pkg/v1workermeta/meta.go | 5 ++- dm/pkg/v1workermeta/meta_test.go | 3 +- dm/relay/binlog_writer.go | 5 ++- dm/relay/binlog_writer_test.go | 1 - dm/relay/file.go | 3 +- dm/relay/file_test.go | 1 - dm/relay/file_util.go | 1 - dm/relay/file_util_test.go | 1 - dm/relay/local_reader.go | 3 +- dm/relay/local_reader_test.go | 1 - dm/relay/meta.go | 1 - dm/relay/meta_test.go | 1 - dm/relay/metrics.go | 5 ++- dm/relay/purge_strategy.go | 5 ++- dm/relay/purger.go | 5 ++- dm/relay/purger_helper.go | 3 +- dm/relay/purger_helper_test.go | 1 - dm/relay/purger_test.go | 1 - dm/relay/relay.go | 5 ++- dm/relay/relay_test.go | 1 - dm/relay/relay_writer.go | 5 ++- dm/relay/relay_writer_test.go | 1 - dm/relay/remote_retry.go | 1 - dm/relay/streamer.go | 5 ++- dm/relay/streamer_test.go | 1 - dm/relay/upstream_reader.go | 3 +- dm/relay/upstream_reader_test.go | 1 - dm/relay/util.go | 1 - dm/relay/util_test.go | 1 - dm/simulator/internal/mcp/mcp_test.go | 3 +- dm/simulator/internal/mcp/uk_test.go | 3 +- dm/simulator/internal/sqlgen/impl.go | 3 +- dm/simulator/internal/sqlgen/impl_test.go | 3 +- dm/syncer/binlogstream/binlog_locations.go | 3 +- dm/syncer/binlogstream/streamer_controller.go | 5 ++- dm/syncer/causality.go | 6 ++-- dm/syncer/causality_test.go | 5 ++- dm/syncer/checkpoint.go | 16 +++++----- dm/syncer/checkpoint_flush_worker.go | 5 ++- dm/syncer/checkpoint_test.go | 5 ++- dm/syncer/compactor.go | 5 ++- dm/syncer/data_validator.go | 5 ++- dm/syncer/data_validator_test.go | 5 ++- dm/syncer/dbconn/db.go | 5 ++- dm/syncer/dbconn/upstream_db.go | 3 +- dm/syncer/dbconn/upstream_db_test.go | 1 - dm/syncer/ddl_test.go | 7 ++--- dm/syncer/dml.go | 7 ++--- dm/syncer/dml_test.go | 10 +++--- dm/syncer/dml_worker.go | 5 ++- dm/syncer/dml_worker_test.go | 3 +- dm/syncer/error.go | 5 ++- dm/syncer/error_test.go | 3 +- dm/syncer/expr_filter_group.go | 5 ++- dm/syncer/expr_filter_group_test.go | 3 +- dm/syncer/filter.go | 3 +- dm/syncer/filter_test.go | 5 ++- dm/syncer/handle_error.go | 4 +-- dm/syncer/handle_error_test.go | 5 ++- dm/syncer/job.go | 1 - dm/syncer/job_test.go | 3 +- dm/syncer/metrics/validator_metrics.go | 3 +- dm/syncer/online-ddl-tools/online_ddl.go | 13 ++++---- dm/syncer/opt_sharding_group.go | 3 +- dm/syncer/opt_sharding_group_test.go | 5 ++- dm/syncer/optimist.go | 3 +- dm/syncer/relay.go | 3 +- dm/syncer/safe-mode/mode.go | 3 +- dm/syncer/safe-mode/mode_test.go | 1 - dm/syncer/safe_mode.go | 3 +- dm/syncer/safe_mode_test.go | 7 ++--- dm/syncer/schema.go | 7 ++--- dm/syncer/shardddl/optimist.go | 5 ++- dm/syncer/shardddl/optimist_test.go | 1 - dm/syncer/shardddl/pessimist.go | 5 ++- dm/syncer/shardddl/pessimist_test.go | 5 ++- dm/syncer/sharding-meta/shardmeta.go | 3 +- dm/syncer/sharding-meta/shardmeta_test.go | 1 - dm/syncer/sharding_group.go | 5 ++- dm/syncer/sharding_group_test.go | 1 - dm/syncer/status.go | 4 +-- dm/syncer/status_test.go | 5 ++- dm/syncer/syncer.go | 7 ++--- dm/syncer/syncer_test.go | 31 +++++++++---------- dm/syncer/test_injector.go | 3 +- dm/syncer/util.go | 5 ++- dm/syncer/validate_worker.go | 5 ++- dm/syncer/validate_worker_test.go | 3 +- dm/syncer/validator_checkpoint.go | 5 ++- dm/syncer/validator_checkpoint_test.go | 5 ++- .../_dmctl_tools/check_exit_safe_binlog.go | 1 - .../_dmctl_tools/check_master_http_apis.go | 3 +- dm/tests/_dmctl_tools/check_master_online.go | 4 +-- .../_dmctl_tools/check_master_online_http.go | 3 +- dm/tests/_dmctl_tools/check_worker_online.go | 4 +-- dm/tests/utils/dmctl.go | 3 +- dm/tests/utils/log.go | 3 +- dm/unit/unit_test.go | 1 - dm/worker/config.go | 1 - dm/worker/config_test.go | 1 - dm/worker/join.go | 5 ++- dm/worker/metrics.go | 11 +++---- dm/worker/relay.go | 5 ++- dm/worker/relay_test.go | 1 - dm/worker/server.go | 5 ++- dm/worker/server_test.go | 13 ++++---- dm/worker/source_worker.go | 7 ++--- dm/worker/source_worker_test.go | 7 ++--- dm/worker/status.go | 3 +- dm/worker/subtask.go | 9 +++--- dm/worker/subtask_test.go | 5 ++- dm/worker/task_checker.go | 5 ++- dm/worker/task_checker_test.go | 5 ++- dm/worker/utils.go | 3 +- dm/worker/utils_test.go | 5 ++- dm/worker/v1meta.go | 3 +- engine/chaos/cases/case_fake_job.go | 3 +- engine/executor/cvs/cvstask.go | 9 +++--- engine/executor/dm/unitholder.go | 5 ++- engine/executor/dm/unitholder_test.go | 9 +++--- engine/executor/dm/worker.go | 7 ++--- engine/executor/dm/worker_test.go | 5 ++- engine/executor/openapi.go | 1 - engine/executor/openapi_test.go | 3 +- engine/executor/worker/ctx_test.go | 3 +- engine/executor/worker/internal/runnables.go | 5 ++- engine/executor/worker/task_committer.go | 5 ++- engine/executor/worker/task_committer_test.go | 5 ++- engine/executor/worker/task_runner.go | 5 ++- engine/executor/worker/task_runner_test.go | 5 ++- engine/executor/worker/test_util.go | 3 +- engine/framework/base_jobmaster.go | 3 +- engine/framework/base_jobmaster_test.go | 5 ++- engine/framework/common.go | 3 +- engine/framework/fake/fake_master.go | 7 ++--- engine/framework/fake/fake_worker.go | 11 +++---- .../internal/errors/fail_fast_test.go | 3 +- engine/framework/internal/eventloop/runner.go | 5 ++- .../internal/eventloop/runner_test.go | 7 ++--- .../framework/internal/master/mock_handle.go | 3 +- .../framework/internal/master/worker_entry.go | 5 ++- .../internal/master/worker_handle.go | 3 +- .../internal/master/worker_manager.go | 3 +- .../internal/master/worker_manager_test.go | 7 ++--- .../internal/worker/master_client.go | 5 ++- .../internal/worker/master_client_test.go | 3 +- .../framework/internal/worker/master_info.go | 3 +- engine/framework/master.go | 12 +++---- engine/framework/message_router.go | 5 ++- engine/framework/message_router_test.go | 5 ++- engine/framework/metadata/metadata.go | 3 +- engine/framework/metadata/metadata_test.go | 3 +- engine/framework/mock_master_impl.go | 11 +++---- engine/framework/mock_master_util.go | 3 +- engine/framework/mock_worker_impl.go | 7 ++--- engine/framework/mock_worker_util.go | 3 +- engine/framework/model/worker.go | 1 - engine/framework/registry/factory.go | 1 - engine/framework/registry/factory_test.go | 5 ++- engine/framework/registry/registry.go | 5 ++- engine/framework/registry/registry_test.go | 3 +- engine/framework/statusutil/writer.go | 6 ++-- engine/framework/statusutil/writer_test.go | 3 +- engine/framework/worker.go | 5 ++- engine/framework/worker_test.go | 7 ++--- engine/jobmaster/cvsjob/cvs_job_master.go | 7 ++--- engine/jobmaster/dm/checkpoint/agent_test.go | 3 +- engine/jobmaster/dm/dm_jobmaster.go | 3 +- engine/jobmaster/dm/dm_jobmaster_test.go | 15 +++++---- .../dm/metadata/cluster_info_test.go | 3 +- engine/jobmaster/dm/metadata/job.go | 3 +- engine/jobmaster/dm/metadata/job_test.go | 3 +- engine/jobmaster/dm/metadata/state.go | 1 - engine/jobmaster/dm/metadata/state_test.go | 3 +- .../jobmaster/dm/runtime/task_status_test.go | 3 +- .../dm/runtime/worker_status_test.go | 3 +- engine/jobmaster/dm/task_manager.go | 5 ++- engine/jobmaster/dm/task_manager_test.go | 7 ++--- engine/jobmaster/example/master_impl.go | 3 +- engine/jobmaster/example/worker_impl.go | 3 +- engine/pkg/client/discovery_client.go | 3 +- .../client/executor_service_client_test.go | 5 ++- engine/pkg/cmd/cli/cli.go | 3 +- engine/pkg/cmd/cli/cli_job.go | 3 +- engine/pkg/cmd/cmd.go | 3 +- engine/pkg/cmd/executor/executor.go | 7 ++--- engine/pkg/cmd/master/master.go | 7 ++--- engine/pkg/cmd/util/helper.go | 3 +- engine/pkg/cmd/version/version.go | 3 +- engine/pkg/dataset/dataset_test.go | 3 +- engine/pkg/deps/deps_test.go | 3 +- engine/pkg/dm/message_agent_test.go | 5 ++- .../broker/storage_handle_test.go | 7 ++--- .../integration_test/gc_test.go | 5 ++- .../internal/local/file_manager_test.go | 3 +- .../internal/local/file_utils.go | 3 +- .../manager/gc_coordinator.go | 10 +++--- .../manager/gc_coordinator_test.go | 5 ++- .../pkg/externalresource/manager/gc_runner.go | 9 +++--- .../manager/gc_runner_test.go | 3 +- .../pkg/externalresource/manager/service.go | 7 ++--- engine/pkg/meta/internal/etcdkv/connection.go | 7 ++--- engine/pkg/meta/internal/etcdkv/etcd_impl.go | 3 +- engine/pkg/meta/internal/etcdkv/util.go | 5 ++- engine/pkg/meta/internal/sqlkv/sql_impl.go | 7 ++--- engine/pkg/notifier/notifier.go | 3 +- engine/pkg/orm/client.go | 5 ++- engine/pkg/orm/client_test.go | 6 ++-- engine/pkg/orm/mock.go | 3 +- engine/pkg/orm/util.go | 10 +++--- engine/pkg/promutil/registry.go | 3 +- engine/pkg/promutil/util_inner.go | 5 ++- engine/pkg/rpcutil/client.go | 5 ++- engine/pkg/rpcutil/client_test.go | 5 ++- engine/pkg/rpcutil/server.go | 5 ++- engine/servermaster/config.go | 3 +- engine/servermaster/http.go | 1 - engine/servermaster/job_fsm.go | 11 +++---- engine/servermaster/jobmanager.go | 16 +++++----- engine/servermaster/jobmanager_test.go | 24 +++++++------- engine/servermaster/jobop/operator.go | 7 ++--- engine/servermaster/jobop/operator_test.go | 16 +++++----- engine/servermaster/server.go | 21 ++++++------- engine/test/e2e/e2e_dm_test.go | 3 +- engine/test/e2e/e2e_node_chaos_test.go | 5 ++- engine/test/e2e/e2e_test.go | 5 ++- engine/test/e2e/e2e_worker_exit_test.go | 5 ++- engine/test/mock/grpc.go | 3 +- engine/test/util_test.go | 1 - pkg/cmd/cli/cli_changefeed_query.go | 1 - pkg/cmd/cli/cli_changefeed_resume_test.go | 3 +- pkg/cmd/factory/factory_impl.go | 9 +++--- pkg/config/sink.go | 1 - pkg/errors/reflect_test.go | 3 +- pkg/errorutil/util.go | 7 ++--- pkg/etcd/etcd.go | 9 +++--- pkg/filter/filter_test.go | 5 ++- pkg/filter/filter_test_helper.go | 3 +- pkg/httputil/httputil_test.go | 3 +- pkg/orchestrator/etcd_worker_test.go | 7 ++--- pkg/p2p/server.go | 5 ++- pkg/p2p/server_client_integration_test.go | 7 ++--- pkg/p2p/server_test.go | 3 +- pkg/sqlmodel/causality.go | 3 +- pkg/sqlmodel/causality_test.go | 3 +- pkg/sqlmodel/multirow.go | 3 +- pkg/sqlmodel/multirow_test.go | 3 +- pkg/sqlmodel/reduce.go | 3 +- pkg/sqlmodel/reduce_test.go | 3 +- pkg/sqlmodel/row_change.go | 3 +- pkg/sqlmodel/row_change_test.go | 5 ++- pkg/workerpool/async_pool_test.go | 4 +-- tests/integration_tests/dailytest/parser.go | 4 +-- .../http_proxies/run-proxy.go | 3 +- tests/utils/cdc_state_checker/cdc_monitor.go | 7 ++--- tools/Makefile | 3 ++ tools/check/tools.go | 1 + 480 files changed, 793 insertions(+), 1295 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d7975dbb5ee..277cb0b7942 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,5 @@ run: - go: 1.19 + go: "1.19" linters: enable: - unconvert @@ -14,7 +14,6 @@ linters: - structcheck - deadcode - gosimple - - goimports - errcheck - staticcheck - stylecheck diff --git a/Makefile b/Makefile index bce68cb17df..ec7b1600a61 100644 --- a/Makefile +++ b/Makefile @@ -227,8 +227,10 @@ clean_integration_test_containers: ## Clean MySQL and Kafka integration test con docker-compose -f $(TICDC_DOCKER_DEPLOYMENTS_DIR)/docker-compose-mysql-integration.yml down -v docker-compose -f $(TICDC_DOCKER_DEPLOYMENTS_DIR)/docker-compose-kafka-integration.yml down -v -fmt: tools/bin/gofumports tools/bin/shfmt generate_mock generate-msgp-code tiflow-generate-mock - @echo "gofmt (simplify)" +fmt: tools/bin/gofumports tools/bin/shfmt tools/bin/gci generate_mock generate-msgp-code tiflow-generate-mock + @echo "run gci (format imports)" + tools/bin/gci write $(FILES) 2>&1 | $(FAIL_ON_STDOUT) + @echo "run gofumports" tools/bin/gofumports -l -w $(FILES) 2>&1 | $(FAIL_ON_STDOUT) @echo "run shfmt" tools/bin/shfmt -d -w . diff --git a/cdc/api/owner/owner.go b/cdc/api/owner/owner.go index 5ddd3e7ccbe..0778c4c0f3b 100644 --- a/cdc/api/owner/owner.go +++ b/cdc/api/owner/owner.go @@ -26,14 +26,13 @@ import ( "github.com/pingcap/log" "github.com/pingcap/tiflow/cdc/api" "github.com/pingcap/tiflow/cdc/api/middleware" - "github.com/tikv/client-go/v2/oracle" - "go.etcd.io/etcd/client/v3/concurrency" - "go.uber.org/zap" - "github.com/pingcap/tiflow/cdc/capture" "github.com/pingcap/tiflow/cdc/model" cerror "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/logutil" + "github.com/tikv/client-go/v2/oracle" + "go.etcd.io/etcd/client/v3/concurrency" + "go.uber.org/zap" ) const ( diff --git a/cdc/entry/schema/snapshot.go b/cdc/entry/schema/snapshot.go index 91d7460738a..34d1d26a146 100644 --- a/cdc/entry/schema/snapshot.go +++ b/cdc/entry/schema/snapshot.go @@ -23,16 +23,15 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" "github.com/pingcap/tidb/ddl" + timeta "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/parser/ast" + timodel "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/session" "github.com/pingcap/tiflow/cdc/model" - "go.uber.org/zap" - - timeta "github.com/pingcap/tidb/meta" - timodel "github.com/pingcap/tidb/parser/model" cerror "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/zap" ) // Snapshot stores the source TiDB all schema information. diff --git a/cdc/entry/schema_storage_test.go b/cdc/entry/schema_storage_test.go index 46257f413bc..5ef9d5b626e 100644 --- a/cdc/entry/schema_storage_test.go +++ b/cdc/entry/schema_storage_test.go @@ -32,12 +32,11 @@ import ( "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/testkit" "github.com/pingcap/tidb/types" - "github.com/stretchr/testify/require" - "github.com/tikv/client-go/v2/oracle" - "github.com/pingcap/tiflow/cdc/entry/schema" "github.com/pingcap/tiflow/cdc/kv" "github.com/pingcap/tiflow/cdc/model" + "github.com/stretchr/testify/require" + "github.com/tikv/client-go/v2/oracle" ) func TestSchema(t *testing.T) { diff --git a/cdc/http.go b/cdc/http.go index 0c4c696290f..38b8b3d1b9c 100644 --- a/cdc/http.go +++ b/cdc/http.go @@ -24,14 +24,12 @@ import ( v1 "github.com/pingcap/tiflow/cdc/api/v1" v2 "github.com/pingcap/tiflow/cdc/api/v2" "github.com/pingcap/tiflow/cdc/capture" + _ "github.com/pingcap/tiflow/docs/swagger" // use for OpenAPI online docs "github.com/pingcap/tiflow/pkg/util" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" swaggerFiles "github.com/swaggo/files" ginSwagger "github.com/swaggo/gin-swagger" - - // use for OpenAPI online docs - _ "github.com/pingcap/tiflow/docs/swagger" ) // RegisterRoutes create a router for OpenAPI diff --git a/cdc/owner/status_provider.go b/cdc/owner/status_provider.go index 89515b91563..3e2b615d14d 100644 --- a/cdc/owner/status_provider.go +++ b/cdc/owner/status_provider.go @@ -16,10 +16,9 @@ package owner import ( "context" - cerror "github.com/pingcap/tiflow/pkg/errors" - "github.com/pingcap/errors" "github.com/pingcap/tiflow/cdc/model" + cerror "github.com/pingcap/tiflow/pkg/errors" ) // StatusProvider provide some func to get meta-information from owner diff --git a/cdc/processor/pipeline/sink.go b/cdc/processor/pipeline/sink.go index da8619358b6..10c073a65dc 100755 --- a/cdc/processor/pipeline/sink.go +++ b/cdc/processor/pipeline/sink.go @@ -19,8 +19,6 @@ import ( "sync/atomic" "time" - "golang.org/x/time/rate" - "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" @@ -32,6 +30,7 @@ import ( cerror "github.com/pingcap/tiflow/pkg/errors" pmessage "github.com/pingcap/tiflow/pkg/pipeline/message" "go.uber.org/zap" + "golang.org/x/time/rate" ) const ( diff --git a/cdc/processor/pipeline/table_actor_test.go b/cdc/processor/pipeline/table_actor_test.go index 387ff6f140f..af0a17ddbcc 100644 --- a/cdc/processor/pipeline/table_actor_test.go +++ b/cdc/processor/pipeline/table_actor_test.go @@ -28,7 +28,6 @@ import ( "github.com/pingcap/tiflow/pkg/actor" "github.com/pingcap/tiflow/pkg/actor/message" "github.com/pingcap/tiflow/pkg/config" - serverConfig "github.com/pingcap/tiflow/pkg/config" cdcContext "github.com/pingcap/tiflow/pkg/context" pmessage "github.com/pingcap/tiflow/pkg/pipeline/message" "github.com/pingcap/tiflow/pkg/upstream" @@ -76,8 +75,8 @@ func TestTableActorInterface(t *testing.T) { redoManager: redo.NewDisabledManager(), tableName: "t1", state: tablepb.TableStatePreparing, - replicaConfig: &serverConfig.ReplicaConfig{ - Consistent: &serverConfig.ConsistentConfig{ + replicaConfig: &config.ReplicaConfig{ + Consistent: &config.ConsistentConfig{ Level: "node", }, }, diff --git a/cdc/redo/common/util_test.go b/cdc/redo/common/util_test.go index 7d73bf027be..e8b08900557 100644 --- a/cdc/redo/common/util_test.go +++ b/cdc/redo/common/util_test.go @@ -17,9 +17,8 @@ import ( "fmt" "testing" - "github.com/pingcap/tiflow/cdc/model" - "github.com/google/uuid" + "github.com/pingcap/tiflow/cdc/model" "github.com/stretchr/testify/require" ) diff --git a/cdc/redo/writer/file.go b/cdc/redo/writer/file.go index 1852c9759ae..2a5fab908c1 100644 --- a/cdc/redo/writer/file.go +++ b/cdc/redo/writer/file.go @@ -28,17 +28,16 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" "github.com/pingcap/tidb/br/pkg/storage" - "github.com/prometheus/client_golang/prometheus" - "github.com/uber-go/atomic" - pioutil "go.etcd.io/etcd/pkg/v3/ioutil" - "go.uber.org/multierr" - "go.uber.org/zap" - "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/cdc/redo/common" cerror "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/fsutil" "github.com/pingcap/tiflow/pkg/uuid" + "github.com/prometheus/client_golang/prometheus" + "github.com/uber-go/atomic" + pioutil "go.etcd.io/etcd/pkg/v3/ioutil" + "go.uber.org/multierr" + "go.uber.org/zap" ) const ( diff --git a/cdc/redo/writer/file_test.go b/cdc/redo/writer/file_test.go index b35cf56a43f..388350171e7 100644 --- a/cdc/redo/writer/file_test.go +++ b/cdc/redo/writer/file_test.go @@ -26,13 +26,12 @@ import ( backuppb "github.com/pingcap/kvproto/pkg/brpb" mockstorage "github.com/pingcap/tidb/br/pkg/mock/storage" "github.com/pingcap/tidb/br/pkg/storage" - "github.com/stretchr/testify/require" - "github.com/uber-go/atomic" - "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/cdc/redo/common" "github.com/pingcap/tiflow/pkg/fsutil" "github.com/pingcap/tiflow/pkg/uuid" + "github.com/stretchr/testify/require" + "github.com/uber-go/atomic" ) func TestWriterWrite(t *testing.T) { diff --git a/cdc/scheduler/internal/v2/processor_agent_test.go b/cdc/scheduler/internal/v2/processor_agent_test.go index 7e80a9fc7c5..f776e2be797 100644 --- a/cdc/scheduler/internal/v2/processor_agent_test.go +++ b/cdc/scheduler/internal/v2/processor_agent_test.go @@ -20,17 +20,16 @@ import ( "time" "github.com/pingcap/failpoint" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "go.etcd.io/etcd/api/v3/etcdserverpb" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/cdc/scheduler/internal/v2/protocol" "github.com/pingcap/tiflow/pkg/etcd" "github.com/pingcap/tiflow/pkg/p2p" "github.com/pingcap/tiflow/pkg/version" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" ) const ( diff --git a/cdc/server/server.go b/cdc/server/server.go index 0b692d1a9b3..3d8e0d9d0b4 100644 --- a/cdc/server/server.go +++ b/cdc/server/server.go @@ -27,9 +27,19 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" "github.com/pingcap/tiflow/cdc" + "github.com/pingcap/tiflow/cdc/capture" + "github.com/pingcap/tiflow/cdc/kv" "github.com/pingcap/tiflow/cdc/processor/pipeline/system" ssystem "github.com/pingcap/tiflow/cdc/sorter/db/system" + "github.com/pingcap/tiflow/cdc/sorter/unified" + "github.com/pingcap/tiflow/pkg/config" + cerror "github.com/pingcap/tiflow/pkg/errors" + "github.com/pingcap/tiflow/pkg/etcd" + "github.com/pingcap/tiflow/pkg/fsutil" + "github.com/pingcap/tiflow/pkg/p2p" "github.com/pingcap/tiflow/pkg/pdutil" + "github.com/pingcap/tiflow/pkg/tcpserver" + p2pProto "github.com/pingcap/tiflow/proto/p2p" pd "github.com/tikv/pd/client" "go.etcd.io/etcd/client/pkg/v3/logutil" clientv3 "go.etcd.io/etcd/client/v3" @@ -39,17 +49,6 @@ import ( "golang.org/x/sync/errgroup" "google.golang.org/grpc" "google.golang.org/grpc/backoff" - - "github.com/pingcap/tiflow/cdc/capture" - "github.com/pingcap/tiflow/cdc/kv" - "github.com/pingcap/tiflow/cdc/sorter/unified" - "github.com/pingcap/tiflow/pkg/config" - cerror "github.com/pingcap/tiflow/pkg/errors" - "github.com/pingcap/tiflow/pkg/etcd" - "github.com/pingcap/tiflow/pkg/fsutil" - "github.com/pingcap/tiflow/pkg/p2p" - "github.com/pingcap/tiflow/pkg/tcpserver" - p2pProto "github.com/pingcap/tiflow/proto/p2p" ) const ( diff --git a/cdc/server/server_test.go b/cdc/server/server_test.go index c7080edf21f..f1e0fc870f3 100644 --- a/cdc/server/server_test.go +++ b/cdc/server/server_test.go @@ -29,22 +29,21 @@ import ( "time" "github.com/golang/mock/gomock" - mock_etcd "github.com/pingcap/tiflow/pkg/etcd/mock" - "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/tempurl" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/embed" - "golang.org/x/sync/errgroup" - "github.com/pingcap/tiflow/cdc/capture" "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/pkg/config" cerrors "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/etcd" + mock_etcd "github.com/pingcap/tiflow/pkg/etcd/mock" "github.com/pingcap/tiflow/pkg/httputil" "github.com/pingcap/tiflow/pkg/retry" security2 "github.com/pingcap/tiflow/pkg/security" "github.com/pingcap/tiflow/pkg/util" + "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/tempurl" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/embed" + "golang.org/x/sync/errgroup" ) type testServer struct { diff --git a/cdc/sink/mysql/causality.go b/cdc/sink/mysql/causality.go index 55dd3c8c86d..353822b3ea2 100644 --- a/cdc/sink/mysql/causality.go +++ b/cdc/sink/mysql/causality.go @@ -17,9 +17,8 @@ import ( "encoding/binary" "github.com/pingcap/log" - "go.uber.org/zap" - "github.com/pingcap/tiflow/cdc/model" + "go.uber.org/zap" ) const ( diff --git a/cdc/sink/mysql/mysql.go b/cdc/sink/mysql/mysql.go index 362df77ed9a..e7827256a35 100644 --- a/cdc/sink/mysql/mysql.go +++ b/cdc/sink/mysql/mysql.go @@ -32,10 +32,6 @@ import ( "github.com/pingcap/tidb/parser/charset" timodel "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tiflow/cdc/contextutil" - "github.com/prometheus/client_golang/prometheus" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/cdc/sink/metrics" dmutils "github.com/pingcap/tiflow/dm/pkg/utils" @@ -45,6 +41,9 @@ import ( "github.com/pingcap/tiflow/pkg/notify" "github.com/pingcap/tiflow/pkg/quotes" "github.com/pingcap/tiflow/pkg/retry" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/atomic" + "go.uber.org/zap" ) const ( diff --git a/cdc/sink/mysql/mysql_worker.go b/cdc/sink/mysql/mysql_worker.go index 151b12b21a4..c7ca220fd5a 100644 --- a/cdc/sink/mysql/mysql_worker.go +++ b/cdc/sink/mysql/mysql_worker.go @@ -20,13 +20,12 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/cdc/model" cerror "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/notify" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/atomic" + "go.uber.org/zap" ) type mysqlSinkWorker struct { diff --git a/cmd/dm-master/main.go b/cmd/dm-master/main.go index c17bbe0295f..5c596cd127b 100644 --- a/cmd/dm-master/main.go +++ b/cmd/dm-master/main.go @@ -23,14 +23,13 @@ import ( "syscall" "github.com/pingcap/errors" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/master" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/pkg/version" + "go.uber.org/zap" ) func main() { diff --git a/cmd/dm-syncer/config.go b/cmd/dm-syncer/config.go index ec55a742a24..7c2e46af680 100644 --- a/cmd/dm-syncer/config.go +++ b/cmd/dm-syncer/config.go @@ -24,7 +24,6 @@ import ( bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" "github.com/pingcap/tidb/util/filter" router "github.com/pingcap/tidb/util/table-router" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/pkg/version" diff --git a/cmd/dm-syncer/main.go b/cmd/dm-syncer/main.go index d329ba17263..25c942aadb1 100644 --- a/cmd/dm-syncer/main.go +++ b/cmd/dm-syncer/main.go @@ -22,6 +22,8 @@ import ( "strings" "syscall" + "github.com/pingcap/errors" + globalLog "github.com/pingcap/log" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" @@ -29,9 +31,6 @@ import ( "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/syncer" "github.com/pingcap/tiflow/pkg/version" - - "github.com/pingcap/errors" - globalLog "github.com/pingcap/log" "go.uber.org/zap" ) diff --git a/cmd/dm-worker/main.go b/cmd/dm-worker/main.go index 1406490bfb7..f0ef076c72d 100644 --- a/cmd/dm-worker/main.go +++ b/cmd/dm-worker/main.go @@ -23,8 +23,6 @@ import ( "github.com/pingcap/errors" globalLog "github.com/pingcap/log" - "go.uber.org/zap" - lightningLog "github.com/pingcap/tidb/br/pkg/lightning/log" "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pkg/log" @@ -32,6 +30,7 @@ import ( "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/worker" "github.com/pingcap/tiflow/pkg/version" + "go.uber.org/zap" ) func main() { diff --git a/cmd/dm-worker/main_test.go b/cmd/dm-worker/main_test.go index 81aa1f031a4..1e3f7dcee0d 100644 --- a/cmd/dm-worker/main_test.go +++ b/cmd/dm-worker/main_test.go @@ -24,7 +24,6 @@ import ( "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" - "go.uber.org/zap" ) diff --git a/dm/_utils/terror_gen/checker_template.go b/dm/_utils/terror_gen/checker_template.go index 291c529769e..c8bd546c613 100644 --- a/dm/_utils/terror_gen/checker_template.go +++ b/dm/_utils/terror_gen/checker_template.go @@ -24,7 +24,6 @@ import ( "strings" "github.com/BurntSushi/toml" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/chaos/cases/cases.go b/dm/chaos/cases/cases.go index 2affed1d98e..9b10177928b 100644 --- a/dm/chaos/cases/cases.go +++ b/dm/chaos/cases/cases.go @@ -17,11 +17,10 @@ import ( "context" "path/filepath" - "golang.org/x/sync/errgroup" - config2 "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/utils" + "golang.org/x/sync/errgroup" ) var ( diff --git a/dm/chaos/cases/db.go b/dm/chaos/cases/db.go index ec12651f490..02e758cae11 100644 --- a/dm/chaos/cases/db.go +++ b/dm/chaos/cases/db.go @@ -23,12 +23,11 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/util/dbutil" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/retry" + "go.uber.org/zap" ) // dbConn holds a connection to a database and supports to reset the connection. diff --git a/dm/chaos/cases/diff.go b/dm/chaos/cases/diff.go index 51d361a5df2..8c1bf2851c4 100644 --- a/dm/chaos/cases/diff.go +++ b/dm/chaos/cases/diff.go @@ -22,9 +22,8 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/tidb-tools/pkg/diff" "github.com/pingcap/tidb/util/dbutil" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" + "go.uber.org/zap" ) // diffDataLoop checks whether target has the same data with source via `sync-diff-inspector` multiple times. diff --git a/dm/chaos/cases/main.go b/dm/chaos/cases/main.go index 6d3b960a9c9..7ddf77e78ed 100644 --- a/dm/chaos/cases/main.go +++ b/dm/chaos/cases/main.go @@ -25,11 +25,10 @@ import ( "time" "github.com/pingcap/errors" - "go.uber.org/zap" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/log" + "go.uber.org/zap" + "google.golang.org/grpc" ) // main starts to run the test case logic after MySQL, TiDB and DM have been set up. diff --git a/dm/chaos/cases/task.go b/dm/chaos/cases/task.go index 0b409993d8c..0259fe54c9f 100644 --- a/dm/chaos/cases/task.go +++ b/dm/chaos/cases/task.go @@ -25,14 +25,13 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/util/dbutil" - "go.uber.org/zap" - "golang.org/x/sync/errgroup" - config2 "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/conn" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" + "golang.org/x/sync/errgroup" ) const ( diff --git a/dm/checker/check_test.go b/dm/checker/check_test.go index 31682dcbae5..1e3043e9be6 100644 --- a/dm/checker/check_test.go +++ b/dm/checker/check_test.go @@ -22,12 +22,11 @@ import ( gmysql "github.com/go-sql-driver/mysql" "github.com/pingcap/tidb/parser/mysql" router "github.com/pingcap/tidb/util/table-router" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pkg/conn" "github.com/pingcap/tiflow/dm/pkg/cputil" + "github.com/stretchr/testify/require" ) var ( diff --git a/dm/checker/checker.go b/dm/checker/checker.go index f974a7ef6aa..4ac21b529c3 100644 --- a/dm/checker/checker.go +++ b/dm/checker/checker.go @@ -24,6 +24,11 @@ import ( "sync" "time" + _ "github.com/go-sql-driver/mysql" // for mysql + "github.com/pingcap/tidb/dumpling/export" + "github.com/pingcap/tidb/parser/mysql" + "github.com/pingcap/tidb/util/dbutil" + "github.com/pingcap/tidb/util/filter" regexprrouter "github.com/pingcap/tidb/util/regexpr-router" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" @@ -39,15 +44,9 @@ import ( "github.com/pingcap/tiflow/dm/pkg/utils" onlineddl "github.com/pingcap/tiflow/dm/syncer/online-ddl-tools" "github.com/pingcap/tiflow/dm/unit" - "golang.org/x/sync/errgroup" - - _ "github.com/go-sql-driver/mysql" // for mysql - "github.com/pingcap/tidb/dumpling/export" - "github.com/pingcap/tidb/parser/mysql" - "github.com/pingcap/tidb/util/dbutil" - "github.com/pingcap/tidb/util/filter" "go.uber.org/atomic" "go.uber.org/zap" + "golang.org/x/sync/errgroup" ) const ( diff --git a/dm/config/source_config.go b/dm/config/source_config.go index 52bae132434..4c292494a24 100644 --- a/dm/config/source_config.go +++ b/dm/config/source_config.go @@ -28,15 +28,13 @@ import ( "github.com/BurntSushi/toml" "github.com/go-mysql-org/go-mysql/mysql" - "go.uber.org/zap" - "gopkg.in/yaml.v2" - bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" - "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" + "gopkg.in/yaml.v2" ) const ( diff --git a/dm/config/source_config_test.go b/dm/config/source_config_test.go index c9dc11cd070..0277166cc8e 100644 --- a/dm/config/source_config_test.go +++ b/dm/config/source_config_test.go @@ -28,9 +28,8 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/go-mysql-org/go-mysql/mysql" bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/stretchr/testify/require" ) func TestConfigFunctions(t *testing.T) { diff --git a/dm/config/source_converter_test.go b/dm/config/source_converter_test.go index ec4e36ddaaf..e109b79b229 100644 --- a/dm/config/source_converter_test.go +++ b/dm/config/source_converter_test.go @@ -15,7 +15,6 @@ package config import ( "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/openapi/fixtures" ) diff --git a/dm/config/subtask.go b/dm/config/subtask.go index 67cd4043a40..315d5983d0d 100644 --- a/dm/config/subtask.go +++ b/dm/config/subtask.go @@ -34,14 +34,13 @@ import ( "github.com/pingcap/tidb/util/filter" regexprrouter "github.com/pingcap/tidb/util/regexpr-router" router "github.com/pingcap/tidb/util/table-router" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/storage" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/engine/pkg/promutil" "github.com/pingcap/tiflow/pkg/version" + "go.uber.org/zap" ) // task modes. diff --git a/dm/config/task.go b/dm/config/task.go index 453bb5f36a3..7aa320aadc3 100644 --- a/dm/config/task.go +++ b/dm/config/task.go @@ -32,12 +32,11 @@ import ( "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/util/filter" router "github.com/pingcap/tidb/util/table-router" - "go.uber.org/zap" - "gopkg.in/yaml.v2" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" + "gopkg.in/yaml.v2" ) // Online DDL Scheme. diff --git a/dm/config/task_converters.go b/dm/config/task_converters.go index 0c56e9a5892..799871b4868 100644 --- a/dm/config/task_converters.go +++ b/dm/config/task_converters.go @@ -21,12 +21,11 @@ import ( "github.com/pingcap/tidb-tools/pkg/column-mapping" "github.com/pingcap/tidb/util/filter" router "github.com/pingcap/tidb/util/table-router" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/openapi" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/storage" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) // TaskConfigToSubTaskConfigs generates sub task configs by TaskConfig. diff --git a/dm/config/task_converters_test.go b/dm/config/task_converters_test.go index 5a84bed64d1..16fc71365aa 100644 --- a/dm/config/task_converters_test.go +++ b/dm/config/task_converters_test.go @@ -19,11 +19,10 @@ import ( "github.com/pingcap/check" bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" "github.com/pingcap/tidb/util/filter" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/openapi" "github.com/pingcap/tiflow/dm/openapi/fixtures" "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/stretchr/testify/require" ) func (t *testConfig) TestTaskGetTargetDBCfg(c *check.C) { diff --git a/dm/config/task_test.go b/dm/config/task_test.go index 79e0cbe5c64..df97cc96f7d 100644 --- a/dm/config/task_test.go +++ b/dm/config/task_test.go @@ -20,14 +20,12 @@ import ( "sort" "strings" + "github.com/coreos/go-semver/semver" . "github.com/pingcap/check" bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" "github.com/pingcap/tidb/util/filter" router "github.com/pingcap/tidb/util/table-router" - "github.com/pingcap/tiflow/dm/pkg/terror" - - "github.com/coreos/go-semver/semver" ) var correctTaskConfig = `--- diff --git a/dm/ctl/common/config.go b/dm/ctl/common/config.go index 7c1defab29f..0195a00e235 100644 --- a/dm/ctl/common/config.go +++ b/dm/ctl/common/config.go @@ -21,16 +21,14 @@ import ( "strings" "time" + "github.com/BurntSushi/toml" "github.com/google/shlex" - "go.uber.org/zap" - + "github.com/pingcap/errors" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" - - "github.com/BurntSushi/toml" - "github.com/pingcap/errors" "github.com/spf13/pflag" + "go.uber.org/zap" ) const ( diff --git a/dm/ctl/common/util.go b/dm/ctl/common/util.go index cd6e45aa34e..0b6c5ae60b8 100644 --- a/dm/ctl/common/util.go +++ b/dm/ctl/common/util.go @@ -31,19 +31,18 @@ import ( "github.com/pingcap/failpoint" toolutils "github.com/pingcap/tidb-tools/pkg/utils" "github.com/pingcap/tidb/parser" - "github.com/spf13/cobra" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/log" parserpkg "github.com/pingcap/tiflow/dm/pkg/parser" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/spf13/cobra" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) var ( diff --git a/dm/ctl/ctl.go b/dm/ctl/ctl.go index 90a335d9273..6b321095797 100644 --- a/dm/ctl/ctl.go +++ b/dm/ctl/ctl.go @@ -19,13 +19,12 @@ import ( "os" "strings" + "github.com/chzyer/readline" + "github.com/pingcap/errors" "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/ctl/master" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" - - "github.com/chzyer/readline" - "github.com/pingcap/errors" "github.com/pingcap/tiflow/pkg/version" "github.com/spf13/cobra" "go.uber.org/zap/zapcore" diff --git a/dm/ctl/master/binlog.go b/dm/ctl/master/binlog.go index c146e8226ff..15c964ffc65 100644 --- a/dm/ctl/master/binlog.go +++ b/dm/ctl/master/binlog.go @@ -16,7 +16,6 @@ package master import ( "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" - "github.com/spf13/cobra" ) diff --git a/dm/ctl/master/check_task.go b/dm/ctl/master/check_task.go index 3af41957942..cd62f948f58 100644 --- a/dm/ctl/master/check_task.go +++ b/dm/ctl/master/check_task.go @@ -19,12 +19,11 @@ import ( "errors" "os" - "github.com/pingcap/tiflow/dm/config" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/checker" + "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) // NewCheckTaskCmd creates a CheckTask command. diff --git a/dm/ctl/master/config.go b/dm/ctl/master/config.go index d8408d5303d..1f84f02419a 100644 --- a/dm/ctl/master/config.go +++ b/dm/ctl/master/config.go @@ -22,14 +22,13 @@ import ( "strings" "github.com/pingcap/errors" - "github.com/spf13/cobra" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/ha" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/spf13/cobra" + clientv3 "go.etcd.io/etcd/client/v3" ) var ( diff --git a/dm/ctl/master/get_config.go b/dm/ctl/master/get_config.go index 6df71c6d90a..ad7d7ba7c93 100644 --- a/dm/ctl/master/get_config.go +++ b/dm/ctl/master/get_config.go @@ -19,10 +19,9 @@ import ( "fmt" "os" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) const cmdGetTaskConfig = "get-task-config" diff --git a/dm/ctl/master/handle_error.go b/dm/ctl/master/handle_error.go index 7675ca81960..43c4068ca74 100644 --- a/dm/ctl/master/handle_error.go +++ b/dm/ctl/master/handle_error.go @@ -18,11 +18,10 @@ import ( "errors" "os" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" + "github.com/spf13/cobra" ) // NewHandleErrorCmd creates a HandleError command. diff --git a/dm/ctl/master/list_member.go b/dm/ctl/master/list_member.go index b57ecd151eb..dd511a8cc20 100644 --- a/dm/ctl/master/list_member.go +++ b/dm/ctl/master/list_member.go @@ -18,10 +18,9 @@ import ( "errors" "os" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) var listMemberFlags = ListMemberFlags{} diff --git a/dm/ctl/master/offline_member.go b/dm/ctl/master/offline_member.go index 61e87cfe988..493f9585839 100644 --- a/dm/ctl/master/offline_member.go +++ b/dm/ctl/master/offline_member.go @@ -17,10 +17,9 @@ import ( "context" "os" + "github.com/pingcap/errors" "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" - - "github.com/pingcap/errors" "github.com/spf13/cobra" ) diff --git a/dm/ctl/master/operate_leader.go b/dm/ctl/master/operate_leader.go index 43f7e306530..d7364c81155 100644 --- a/dm/ctl/master/operate_leader.go +++ b/dm/ctl/master/operate_leader.go @@ -18,10 +18,9 @@ import ( "errors" "os" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) // NewOperateLeaderCmd creates a OperateLeader command. diff --git a/dm/ctl/master/operate_schema.go b/dm/ctl/master/operate_schema.go index 2c097556551..b70a032169a 100644 --- a/dm/ctl/master/operate_schema.go +++ b/dm/ctl/master/operate_schema.go @@ -18,10 +18,9 @@ import ( "errors" "os" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) // NewOperateSchemaCmd creates a OperateSchema command. diff --git a/dm/ctl/master/operate_source.go b/dm/ctl/master/operate_source.go index 452309f0388..eca32c9644a 100644 --- a/dm/ctl/master/operate_source.go +++ b/dm/ctl/master/operate_source.go @@ -19,14 +19,13 @@ import ( "fmt" "os" - "github.com/spf13/cobra" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/spf13/cobra" + "go.uber.org/zap" ) // NewOperateSourceCmd creates a OperateSource command. diff --git a/dm/ctl/master/operate_task.go b/dm/ctl/master/operate_task.go index 21d1b4fab2f..4fb37366caf 100644 --- a/dm/ctl/master/operate_task.go +++ b/dm/ctl/master/operate_task.go @@ -21,10 +21,9 @@ import ( "strings" "sync" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) const ( diff --git a/dm/ctl/master/operate_validation.go b/dm/ctl/master/operate_validation.go index 31b936e8c39..7c48082a8c3 100644 --- a/dm/ctl/master/operate_validation.go +++ b/dm/ctl/master/operate_validation.go @@ -19,10 +19,9 @@ import ( "os" "strconv" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) func NewIgnoreValidationErrorCmd() *cobra.Command { diff --git a/dm/ctl/master/pause_relay.go b/dm/ctl/master/pause_relay.go index b3426b9f022..1584042a3f1 100644 --- a/dm/ctl/master/pause_relay.go +++ b/dm/ctl/master/pause_relay.go @@ -18,10 +18,9 @@ import ( "fmt" "os" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) // NewPauseRelayCmd creates a PauseRelay command. diff --git a/dm/ctl/master/pause_task.go b/dm/ctl/master/pause_task.go index 987fd9b6663..97e28396aef 100644 --- a/dm/ctl/master/pause_task.go +++ b/dm/ctl/master/pause_task.go @@ -14,9 +14,8 @@ package master import ( - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) // NewPauseTaskCmd creates a PauseTask command. diff --git a/dm/ctl/master/purge_relay.go b/dm/ctl/master/purge_relay.go index f7e3c6034fa..24922bae054 100644 --- a/dm/ctl/master/purge_relay.go +++ b/dm/ctl/master/purge_relay.go @@ -20,11 +20,10 @@ import ( "strings" "github.com/pingcap/errors" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/spf13/cobra" ) // NewPurgeRelayCmd creates a PurgeRelay command diff --git a/dm/ctl/master/query_status.go b/dm/ctl/master/query_status.go index aacc4d7ecbc..8ad758d51e9 100644 --- a/dm/ctl/master/query_status.go +++ b/dm/ctl/master/query_status.go @@ -19,10 +19,9 @@ import ( "os" "strings" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) const stageError = "Error" diff --git a/dm/ctl/master/query_status_test.go b/dm/ctl/master/query_status_test.go index b523031b5aa..df6dee021ce 100644 --- a/dm/ctl/master/query_status_test.go +++ b/dm/ctl/master/query_status_test.go @@ -17,9 +17,8 @@ import ( "sort" "testing" - "github.com/pingcap/tiflow/dm/pb" - "github.com/pingcap/check" + "github.com/pingcap/tiflow/dm/pb" ) func TestCtlMaster(t *testing.T) { diff --git a/dm/ctl/master/query_validation.go b/dm/ctl/master/query_validation.go index 80042015acb..fc44c893fb0 100644 --- a/dm/ctl/master/query_validation.go +++ b/dm/ctl/master/query_validation.go @@ -19,11 +19,9 @@ import ( "strings" "github.com/pingcap/errors" - - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) const ( diff --git a/dm/ctl/master/resume_relay.go b/dm/ctl/master/resume_relay.go index 05ebc6d6091..af8786e875c 100644 --- a/dm/ctl/master/resume_relay.go +++ b/dm/ctl/master/resume_relay.go @@ -18,10 +18,9 @@ import ( "fmt" "os" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) // NewResumeRelayCmd creates a ResumeRelay command. diff --git a/dm/ctl/master/resume_task.go b/dm/ctl/master/resume_task.go index 6cf277a7d66..e8374331063 100644 --- a/dm/ctl/master/resume_task.go +++ b/dm/ctl/master/resume_task.go @@ -14,9 +14,8 @@ package master import ( - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) // NewResumeTaskCmd creates a ResumeTask command. diff --git a/dm/ctl/master/show_ddl_locks.go b/dm/ctl/master/show_ddl_locks.go index 5bf95160b64..75e84c34aa0 100644 --- a/dm/ctl/master/show_ddl_locks.go +++ b/dm/ctl/master/show_ddl_locks.go @@ -20,7 +20,6 @@ import ( "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" - "github.com/spf13/cobra" ) diff --git a/dm/ctl/master/source_table_schema.go b/dm/ctl/master/source_table_schema.go index 98f2391b7e9..940322bded7 100644 --- a/dm/ctl/master/source_table_schema.go +++ b/dm/ctl/master/source_table_schema.go @@ -18,7 +18,6 @@ import ( "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" - "github.com/spf13/cobra" ) diff --git a/dm/ctl/master/start_stop_relay.go b/dm/ctl/master/start_stop_relay.go index e96c1be68ef..36fc14d6243 100644 --- a/dm/ctl/master/start_stop_relay.go +++ b/dm/ctl/master/start_stop_relay.go @@ -20,7 +20,6 @@ import ( "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" - "github.com/spf13/cobra" ) diff --git a/dm/ctl/master/start_stop_validation.go b/dm/ctl/master/start_stop_validation.go index cbef6fbd9b0..68d07080005 100644 --- a/dm/ctl/master/start_stop_validation.go +++ b/dm/ctl/master/start_stop_validation.go @@ -19,12 +19,11 @@ import ( "fmt" "os" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/spf13/cobra" ) const ( diff --git a/dm/ctl/master/start_task.go b/dm/ctl/master/start_task.go index 3fb99e08b44..288a8aa1459 100644 --- a/dm/ctl/master/start_task.go +++ b/dm/ctl/master/start_task.go @@ -19,15 +19,14 @@ import ( "errors" "os" - "github.com/spf13/cobra" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/checker" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/spf13/cobra" + "go.uber.org/zap" ) // NewStartTaskCmd creates a StartTask command. diff --git a/dm/ctl/master/stop_task.go b/dm/ctl/master/stop_task.go index 4859d801e0c..c0c21a8a692 100644 --- a/dm/ctl/master/stop_task.go +++ b/dm/ctl/master/stop_task.go @@ -14,9 +14,8 @@ package master import ( - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/dm/pb" + "github.com/spf13/cobra" ) // NewStopTaskCmd creates a StopTask command. diff --git a/dm/ctl/master/transfer_source.go b/dm/ctl/master/transfer_source.go index de445192271..292b66543ba 100644 --- a/dm/ctl/master/transfer_source.go +++ b/dm/ctl/master/transfer_source.go @@ -20,7 +20,6 @@ import ( "github.com/pingcap/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" - "github.com/spf13/cobra" ) diff --git a/dm/ctl/master/unlock_ddl_lock.go b/dm/ctl/master/unlock_ddl_lock.go index 60be9e646a0..cfb172e334e 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/tiflow/dm/ctl/common" "github.com/pingcap/tiflow/dm/pb" - "github.com/spf13/cobra" ) diff --git a/dm/debug-tools/binlog-event-blackhole/fetcher.go b/dm/debug-tools/binlog-event-blackhole/fetcher.go index 081e0a7e313..2a8cba262bb 100644 --- a/dm/debug-tools/binlog-event-blackhole/fetcher.go +++ b/dm/debug-tools/binlog-event-blackhole/fetcher.go @@ -19,10 +19,9 @@ import ( "github.com/go-mysql-org/go-mysql/client" "github.com/pingcap/errors" + "github.com/pingcap/tiflow/dm/pkg/log" "go.uber.org/atomic" "go.uber.org/zap" - - "github.com/pingcap/tiflow/dm/pkg/log" ) // registerSlave register a slave connection on the master. diff --git a/dm/debug-tools/binlog-event-blackhole/main.go b/dm/debug-tools/binlog-event-blackhole/main.go index 13bdf299aae..a355b4ad93a 100644 --- a/dm/debug-tools/binlog-event-blackhole/main.go +++ b/dm/debug-tools/binlog-event-blackhole/main.go @@ -24,9 +24,8 @@ import ( "time" "github.com/pingcap/errors" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" + "go.uber.org/zap" ) func main() { diff --git a/dm/dumpling/dumpling.go b/dm/dumpling/dumpling.go index 1e382f56f15..f94000c9dfd 100644 --- a/dm/dumpling/dumpling.go +++ b/dm/dumpling/dumpling.go @@ -25,21 +25,20 @@ import ( "github.com/pingcap/tidb/dumpling/export" tidbpromutil "github.com/pingcap/tidb/util/promutil" filter "github.com/pingcap/tidb/util/table-filter" - "github.com/pingcap/tiflow/dm/pkg/storage" - "github.com/prometheus/client_golang/prometheus" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/conn" dutils "github.com/pingcap/tiflow/dm/pkg/dumpling" "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/pingcap/tiflow/dm/pkg/storage" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/unit" "github.com/pingcap/tiflow/engine/pkg/promutil" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/atomic" + "go.uber.org/zap" ) // Dumpling dumps full data from a MySQL-compatible database. diff --git a/dm/dumpling/dumpling_test.go b/dm/dumpling/dumpling_test.go index a6fc44fadca..94f480d676a 100644 --- a/dm/dumpling/dumpling_test.go +++ b/dm/dumpling/dumpling_test.go @@ -20,19 +20,18 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/docker/go-units" + . "github.com/pingcap/check" "github.com/pingcap/failpoint" "github.com/pingcap/tidb/dumpling/export" "github.com/pingcap/tidb/util/filter" tidbpromutil "github.com/pingcap/tidb/util/promutil" tfilter "github.com/pingcap/tidb/util/table-filter" - "github.com/pingcap/tiflow/engine/pkg/promutil" - "github.com/prometheus/client_golang/prometheus" - - . "github.com/pingcap/check" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/conn" "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/pingcap/tiflow/engine/pkg/promutil" + "github.com/prometheus/client_golang/prometheus" ) var _ = Suite(&testDumplingSuite{}) diff --git a/dm/loader/checkpoint.go b/dm/loader/checkpoint.go index 5a71d5f6520..e036d52b3dc 100644 --- a/dm/loader/checkpoint.go +++ b/dm/loader/checkpoint.go @@ -21,6 +21,7 @@ import ( "sync" "time" + "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" @@ -28,8 +29,6 @@ import ( fr "github.com/pingcap/tiflow/dm/pkg/func-rollback" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" - - "github.com/pingcap/tidb/util/dbutil" "go.uber.org/zap" ) diff --git a/dm/loader/checkpoint_test.go b/dm/loader/checkpoint_test.go index b529307b8bf..4f85d516464 100644 --- a/dm/loader/checkpoint_test.go +++ b/dm/loader/checkpoint_test.go @@ -22,12 +22,11 @@ import ( "github.com/DATA-DOG/go-sqlmock" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/log" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/cputil" + "github.com/pingcap/tiflow/dm/pkg/log" ) var ( diff --git a/dm/loader/convert_data.go b/dm/loader/convert_data.go index c8af6a5cfa5..25124b06110 100644 --- a/dm/loader/convert_data.go +++ b/dm/loader/convert_data.go @@ -22,15 +22,14 @@ import ( "strings" "unsafe" + "github.com/pingcap/errors" + cm "github.com/pingcap/tidb-tools/pkg/column-mapping" + "github.com/pingcap/tidb/parser/ast" regexprrouter "github.com/pingcap/tidb/util/regexpr-router" tcontext "github.com/pingcap/tiflow/dm/pkg/context" parserpkg "github.com/pingcap/tiflow/dm/pkg/parser" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" - - "github.com/pingcap/errors" - cm "github.com/pingcap/tidb-tools/pkg/column-mapping" - "github.com/pingcap/tidb/parser/ast" ) func bytes2str(bs []byte) string { diff --git a/dm/loader/convert_data_test.go b/dm/loader/convert_data_test.go index 65cee9ca7f4..d09f5b30726 100644 --- a/dm/loader/convert_data_test.go +++ b/dm/loader/convert_data_test.go @@ -14,13 +14,11 @@ package loader import ( + . "github.com/pingcap/check" cm "github.com/pingcap/tidb-tools/pkg/column-mapping" - regexprrouter "github.com/pingcap/tidb/util/regexpr-router" router "github.com/pingcap/tidb/util/table-router" tcontext "github.com/pingcap/tiflow/dm/pkg/context" - - . "github.com/pingcap/check" ) var _ = Suite(&testConvertDataSuite{}) diff --git a/dm/loader/db.go b/dm/loader/db.go index d31b27f5056..a16613d397c 100644 --- a/dm/loader/db.go +++ b/dm/loader/db.go @@ -23,8 +23,6 @@ import ( "github.com/pingcap/failpoint" tmysql "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/util/dbutil" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" @@ -32,6 +30,7 @@ import ( "github.com/pingcap/tiflow/dm/pkg/retry" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // DBConn represents a live DB connection diff --git a/dm/loader/lightning.go b/dm/loader/lightning.go index 1297c506f90..717755a21cf 100644 --- a/dm/loader/lightning.go +++ b/dm/loader/lightning.go @@ -25,13 +25,6 @@ import ( "github.com/pingcap/tidb/br/pkg/lightning/checkpoints" lcfg "github.com/pingcap/tidb/br/pkg/lightning/config" tidbpromutil "github.com/pingcap/tidb/util/promutil" - "github.com/pingcap/tiflow/dm/pkg/terror" - "github.com/pingcap/tiflow/engine/pkg/promutil" - "github.com/prometheus/client_golang/prometheus" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" @@ -39,8 +32,14 @@ import ( tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/storage" + "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/unit" + "github.com/pingcap/tiflow/engine/pkg/promutil" + "github.com/prometheus/client_golang/prometheus" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/atomic" + "go.uber.org/zap" ) const ( diff --git a/dm/loader/loader.go b/dm/loader/loader.go index e18eb01e6c8..2fe752eff7c 100644 --- a/dm/loader/loader.go +++ b/dm/loader/loader.go @@ -25,9 +25,10 @@ import ( "sync" "time" - clientv3 "go.etcd.io/etcd/client/v3" - "golang.org/x/sync/errgroup" - + "github.com/pingcap/errors" + "github.com/pingcap/failpoint" + cm "github.com/pingcap/tidb-tools/pkg/column-mapping" + "github.com/pingcap/tidb/util/filter" regexprrouter "github.com/pingcap/tidb/util/regexpr-router" router "github.com/pingcap/tidb/util/table-router" "github.com/pingcap/tiflow/dm/config" @@ -39,13 +40,10 @@ import ( "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/unit" - - "github.com/pingcap/errors" - "github.com/pingcap/failpoint" - cm "github.com/pingcap/tidb-tools/pkg/column-mapping" - "github.com/pingcap/tidb/util/filter" + clientv3 "go.etcd.io/etcd/client/v3" "go.uber.org/atomic" "go.uber.org/zap" + "golang.org/x/sync/errgroup" ) const ( diff --git a/dm/loader/status.go b/dm/loader/status.go index 1c3d516c8ac..d046ebdaf5a 100644 --- a/dm/loader/status.go +++ b/dm/loader/status.go @@ -17,10 +17,9 @@ import ( "sync" "time" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" + "go.uber.org/zap" ) type statusRecorder struct { diff --git a/dm/loader/status_test.go b/dm/loader/status_test.go index b69db8c41c8..16e17d752cf 100644 --- a/dm/loader/status_test.go +++ b/dm/loader/status_test.go @@ -17,10 +17,9 @@ import ( "sync" . "github.com/pingcap/check" - "go.uber.org/atomic" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/log" + "go.uber.org/atomic" ) func (*testLoaderSuite) TestConcurrentStatus(c *C) { diff --git a/dm/loader/util.go b/dm/loader/util.go index a1a0a678d03..21ba0c30a13 100644 --- a/dm/loader/util.go +++ b/dm/loader/util.go @@ -22,9 +22,6 @@ import ( "path/filepath" "strings" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "github.com/pingcap/failpoint" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/dumpling" @@ -33,6 +30,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/storage" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) // SQLReplace works like strings.Replace but only supports one replacement. diff --git a/dm/master/agent_pool.go b/dm/master/agent_pool.go index 4f4eee68196..3b21e22acbb 100644 --- a/dm/master/agent_pool.go +++ b/dm/master/agent_pool.go @@ -18,7 +18,6 @@ import ( "math" "github.com/pingcap/tiflow/dm/pkg/log" - "go.uber.org/zap" "golang.org/x/time/rate" ) diff --git a/dm/master/bootstrap.go b/dm/master/bootstrap.go index 117c911cfa1..e9a496a3822 100644 --- a/dm/master/bootstrap.go +++ b/dm/master/bootstrap.go @@ -22,8 +22,6 @@ import ( "sync" "time" - "go.uber.org/zap" - "github.com/pingcap/errors" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/master/scheduler" @@ -36,6 +34,7 @@ import ( "github.com/pingcap/tiflow/dm/pkg/upgrade" "github.com/pingcap/tiflow/dm/pkg/v1dbschema" "github.com/pingcap/tiflow/dm/pkg/v1workermeta" + "go.uber.org/zap" ) var ( diff --git a/dm/master/bootstrap_test.go b/dm/master/bootstrap_test.go index 15e7454aef6..984932ccdae 100644 --- a/dm/master/bootstrap_test.go +++ b/dm/master/bootstrap_test.go @@ -24,7 +24,6 @@ import ( "github.com/golang/mock/gomock" . "github.com/pingcap/check" filter "github.com/pingcap/tidb-tools/pkg/binlog-filter" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pbmock" diff --git a/dm/master/config.go b/dm/master/config.go index 5bef2237850..7ad8ac092a7 100644 --- a/dm/master/config.go +++ b/dm/master/config.go @@ -26,14 +26,13 @@ import ( "time" "github.com/BurntSushi/toml" - "go.etcd.io/etcd/server/v3/embed" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/pkg/version" + "go.etcd.io/etcd/server/v3/embed" + "go.uber.org/zap" ) const ( diff --git a/dm/master/config_test.go b/dm/master/config_test.go index 7425bd0edc5..e03c2099f56 100644 --- a/dm/master/config_test.go +++ b/dm/master/config_test.go @@ -23,10 +23,9 @@ import ( capturer "github.com/kami-zh/go-capturer" "github.com/pingcap/check" - "go.etcd.io/etcd/server/v3/embed" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.etcd.io/etcd/server/v3/embed" ) var _ = check.Suite(&testConfigSuite{}) diff --git a/dm/master/election.go b/dm/master/election.go index e150a3b00ad..9ed31431a74 100644 --- a/dm/master/election.go +++ b/dm/master/election.go @@ -20,12 +20,11 @@ import ( "github.com/pingcap/failpoint" toolutils "github.com/pingcap/tidb-tools/pkg/utils" - "go.uber.org/zap" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/dm/master/metrics" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/log" + "go.uber.org/zap" + "google.golang.org/grpc" ) const ( diff --git a/dm/master/election_test.go b/dm/master/election_test.go index 7aea3aad09e..cdfde465f91 100644 --- a/dm/master/election_test.go +++ b/dm/master/election_test.go @@ -21,11 +21,10 @@ import ( "time" "github.com/pingcap/failpoint" - "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/tempurl" - "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/tempurl" ) func TestFailToStartLeader(t *testing.T) { diff --git a/dm/master/etcd.go b/dm/master/etcd.go index 2999de47273..578c8932c6b 100644 --- a/dm/master/etcd.go +++ b/dm/master/etcd.go @@ -22,13 +22,12 @@ import ( "time" toolutils "github.com/pingcap/tidb-tools/pkg/utils" - "go.etcd.io/etcd/server/v3/embed" - "go.uber.org/zap" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.etcd.io/etcd/server/v3/embed" + "go.uber.org/zap" + "google.golang.org/grpc" ) const ( diff --git a/dm/master/etcd_test.go b/dm/master/etcd_test.go index 3d63c91fe6e..67ddc68135a 100644 --- a/dm/master/etcd_test.go +++ b/dm/master/etcd_test.go @@ -23,13 +23,12 @@ import ( "time" "github.com/pingcap/check" - "github.com/tikv/pd/pkg/tempurl" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/embed" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/tikv/pd/pkg/tempurl" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/embed" ) var _ = check.Suite(&testEtcdSuite{}) diff --git a/dm/master/http_handler.go b/dm/master/http_handler.go index ef209b62efa..2206d6f421b 100644 --- a/dm/master/http_handler.go +++ b/dm/master/http_handler.go @@ -20,12 +20,11 @@ import ( "github.com/gogo/gateway" "github.com/grpc-ecosystem/grpc-gateway/runtime" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/pkg/version" + "google.golang.org/grpc" ) // statusHandler handles process status. diff --git a/dm/master/openapi_controller.go b/dm/master/openapi_controller.go index dfe625aa418..aa011763690 100644 --- a/dm/master/openapi_controller.go +++ b/dm/master/openapi_controller.go @@ -24,22 +24,19 @@ import ( "fmt" "strings" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/log" - "go.uber.org/zap" - - "github.com/pingcap/tiflow/dm/master/scheduler" - "github.com/pingcap/tiflow/dm/pkg/ha" - "github.com/pingcap/tiflow/dm/checker" dmcommon "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/ctl/common" + "github.com/pingcap/tiflow/dm/master/scheduler" "github.com/pingcap/tiflow/dm/master/workerrpc" "github.com/pingcap/tiflow/dm/openapi" "github.com/pingcap/tiflow/dm/pb" + "github.com/pingcap/tiflow/dm/pkg/ha" "github.com/pingcap/tiflow/dm/pkg/terror" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) // nolint:unparam diff --git a/dm/master/openapi_controller_test.go b/dm/master/openapi_controller_test.go index 401b835e48d..9f5cbc4158d 100644 --- a/dm/master/openapi_controller_test.go +++ b/dm/master/openapi_controller_test.go @@ -24,8 +24,6 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/pingcap/tiflow/dm/pkg/ha" - "github.com/pingcap/failpoint" "github.com/pingcap/tiflow/dm/checker" "github.com/pingcap/tiflow/dm/config" @@ -34,6 +32,7 @@ import ( "github.com/pingcap/tiflow/dm/openapi/fixtures" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pbmock" + "github.com/pingcap/tiflow/dm/pkg/ha" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/stretchr/testify/suite" diff --git a/dm/master/openapi_view.go b/dm/master/openapi_view.go index a64b0166f65..d8f45b0e712 100644 --- a/dm/master/openapi_view.go +++ b/dm/master/openapi_view.go @@ -28,8 +28,6 @@ import ( "github.com/gin-gonic/gin" "github.com/pingcap/failpoint" "github.com/pingcap/tidb/util/dbutil" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/master/workerrpc" "github.com/pingcap/tiflow/dm/openapi" @@ -38,6 +36,7 @@ import ( "github.com/pingcap/tiflow/dm/pkg/ha" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) const ( diff --git a/dm/master/openapi_view_test.go b/dm/master/openapi_view_test.go index 7951db10523..dffd7b061bd 100644 --- a/dm/master/openapi_view_test.go +++ b/dm/master/openapi_view_test.go @@ -30,10 +30,6 @@ import ( "github.com/deepmap/oapi-codegen/pkg/testutil" "github.com/golang/mock/gomock" "github.com/pingcap/failpoint" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - "github.com/tikv/pd/pkg/tempurl" - "github.com/pingcap/tiflow/dm/checker" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/openapi" @@ -45,6 +41,9 @@ import ( "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/tempurl" ) // some data for test. diff --git a/dm/master/scheduler/scheduler.go b/dm/master/scheduler/scheduler.go index ec99e96b0a2..6ed0d1106a4 100644 --- a/dm/master/scheduler/scheduler.go +++ b/dm/master/scheduler/scheduler.go @@ -21,10 +21,6 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/master/metrics" "github.com/pingcap/tiflow/dm/master/workerrpc" @@ -34,6 +30,9 @@ import ( "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/atomic" + "go.uber.org/zap" ) const ( diff --git a/dm/master/scheduler/scheduler_test.go b/dm/master/scheduler/scheduler_test.go index 218419851eb..2848011496f 100644 --- a/dm/master/scheduler/scheduler_test.go +++ b/dm/master/scheduler/scheduler_test.go @@ -22,18 +22,17 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/tests/v3/integration" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/master/workerrpc" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/ha" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/tests/v3/integration" ) const ( diff --git a/dm/master/scheduler/worker.go b/dm/master/scheduler/worker.go index d7bdabc02d5..af3caca6574 100644 --- a/dm/master/scheduler/worker.go +++ b/dm/master/scheduler/worker.go @@ -19,8 +19,6 @@ import ( "time" "github.com/pingcap/errors" - "go.uber.org/zap" - "github.com/pingcap/failpoint" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/master/metrics" @@ -29,6 +27,7 @@ import ( "github.com/pingcap/tiflow/dm/pkg/ha" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) // WorkerStage represents the stage of a DM-worker instance. diff --git a/dm/master/scheduler/worker_test.go b/dm/master/scheduler/worker_test.go index 1235b0ed21e..c8d3bd38de0 100644 --- a/dm/master/scheduler/worker_test.go +++ b/dm/master/scheduler/worker_test.go @@ -18,13 +18,12 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/master/workerrpc" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/ha" "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/stretchr/testify/require" ) func TestWorker(t *testing.T) { diff --git a/dm/master/server.go b/dm/master/server.go index 4adeae2161e..34bbd26f2de 100644 --- a/dm/master/server.go +++ b/dm/master/server.go @@ -33,12 +33,6 @@ import ( "github.com/pingcap/failpoint" toolutils "github.com/pingcap/tidb-tools/pkg/utils" "github.com/pingcap/tidb/util/dbutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/embed" - "go.uber.org/atomic" - "go.uber.org/zap" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/dm/checker" dmcommon "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" @@ -60,6 +54,11 @@ import ( "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/ui" "github.com/pingcap/tiflow/dm/unit" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/embed" + "go.uber.org/atomic" + "go.uber.org/zap" + "google.golang.org/grpc" ) const ( diff --git a/dm/master/server_test.go b/dm/master/server_test.go index c96fb0d38fd..034aa8c61f1 100644 --- a/dm/master/server_test.go +++ b/dm/master/server_test.go @@ -40,12 +40,6 @@ import ( "github.com/pingcap/tidb/sessionctx" toolutils "github.com/pingcap/tidb/util" tidbmock "github.com/pingcap/tidb/util/mock" - "github.com/tikv/pd/pkg/tempurl" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/verify" - "go.etcd.io/etcd/tests/v3/integration" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/dm/checker" common2 "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" @@ -66,6 +60,11 @@ import ( "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/pkg/version" + "github.com/tikv/pd/pkg/tempurl" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/verify" + "go.etcd.io/etcd/tests/v3/integration" + "google.golang.org/grpc" ) // use task config from integration test `sharding`. diff --git a/dm/master/shardddl/info_test.go b/dm/master/shardddl/info_test.go index 05d5be15442..cd9f42bc8e7 100644 --- a/dm/master/shardddl/info_test.go +++ b/dm/master/shardddl/info_test.go @@ -16,9 +16,8 @@ package shardddl import ( "testing" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pkg/shardddl/pessimism" + "github.com/stretchr/testify/require" ) func TestInfoSlice(t *testing.T) { diff --git a/dm/master/shardddl/optimist.go b/dm/master/shardddl/optimist.go index a680152df94..1287dbd9907 100644 --- a/dm/master/shardddl/optimist.go +++ b/dm/master/shardddl/optimist.go @@ -22,9 +22,6 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/tidb/util/dbutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/master/metrics" @@ -34,6 +31,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/shardddl/optimism" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) // Optimist is used to coordinate the shard DDL migration in optimism mode. diff --git a/dm/master/shardddl/optimist_test.go b/dm/master/shardddl/optimist_test.go index 89a701380db..f996b39144c 100644 --- a/dm/master/shardddl/optimist_test.go +++ b/dm/master/shardddl/optimist_test.go @@ -26,15 +26,14 @@ import ( "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/mock" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/tests/v3/integration" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/shardddl/optimism" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/tests/v3/integration" ) func TestOptimistSuite(t *testing.T) { diff --git a/dm/master/shardddl/pessimist.go b/dm/master/shardddl/pessimist.go index ef0ad64ce9b..f00402ed6a3 100644 --- a/dm/master/shardddl/pessimist.go +++ b/dm/master/shardddl/pessimist.go @@ -19,11 +19,7 @@ import ( "sync" "time" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/master/metrics" "github.com/pingcap/tiflow/dm/pb" @@ -31,6 +27,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/shardddl/pessimism" "github.com/pingcap/tiflow/dm/pkg/terror" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) var ( diff --git a/dm/master/shardddl/pessimist_test.go b/dm/master/shardddl/pessimist_test.go index b8d155db4dc..17ccdeca1c7 100644 --- a/dm/master/shardddl/pessimist_test.go +++ b/dm/master/shardddl/pessimist_test.go @@ -21,18 +21,17 @@ import ( "time" "github.com/pingcap/errors" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/tests/v3/integration" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/shardddl/pessimism" "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/tests/v3/integration" ) var etcdErrCompacted = v3rpc.ErrCompacted diff --git a/dm/master/workerrpc/rawgrpc.go b/dm/master/workerrpc/rawgrpc.go index 679cfd04ec0..435d0470f5a 100644 --- a/dm/master/workerrpc/rawgrpc.go +++ b/dm/master/workerrpc/rawgrpc.go @@ -18,13 +18,12 @@ import ( "time" toolutils "github.com/pingcap/tidb-tools/pkg/utils" - "go.uber.org/atomic" - "google.golang.org/grpc" - "google.golang.org/grpc/backoff" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/atomic" + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" ) // GRPCClient stores raw grpc connection and worker client. diff --git a/dm/master/workerrpc/workerrpc_test.go b/dm/master/workerrpc/workerrpc_test.go index 40dff5db1a3..5ca0d57a469 100644 --- a/dm/master/workerrpc/workerrpc_test.go +++ b/dm/master/workerrpc/workerrpc_test.go @@ -21,12 +21,11 @@ import ( "github.com/golang/mock/gomock" . "github.com/pingcap/check" "github.com/pingcap/errors" - "github.com/tikv/pd/pkg/tempurl" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pbmock" "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/tikv/pd/pkg/tempurl" ) var _ = Suite(&testWorkerRPCSuite{}) diff --git a/dm/pkg/backoff/backoff_test.go b/dm/pkg/backoff/backoff_test.go index 0e8110f8121..93e15242549 100644 --- a/dm/pkg/backoff/backoff_test.go +++ b/dm/pkg/backoff/backoff_test.go @@ -19,7 +19,6 @@ import ( "time" "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/binlog/event/common.go b/dm/pkg/binlog/event/common.go index 2fda1dc160c..e84dc8400d5 100644 --- a/dm/pkg/binlog/event/common.go +++ b/dm/pkg/binlog/event/common.go @@ -19,7 +19,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/binlog/event/common_test.go b/dm/pkg/binlog/event/common_test.go index 4d82a223abf..36f4e72de0b 100644 --- a/dm/pkg/binlog/event/common_test.go +++ b/dm/pkg/binlog/event/common_test.go @@ -21,7 +21,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/gtid" ) diff --git a/dm/pkg/binlog/event/ddl.go b/dm/pkg/binlog/event/ddl.go index ec374b36385..1d4b2bae5aa 100644 --- a/dm/pkg/binlog/event/ddl.go +++ b/dm/pkg/binlog/event/ddl.go @@ -19,7 +19,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/binlog/event/ddl_test.go b/dm/pkg/binlog/event/ddl_test.go index ba926c47533..1622e06e55d 100644 --- a/dm/pkg/binlog/event/ddl_test.go +++ b/dm/pkg/binlog/event/ddl_test.go @@ -19,7 +19,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/gtid" ) diff --git a/dm/pkg/binlog/event/dml.go b/dm/pkg/binlog/event/dml.go index 64bc4b18f05..881fba68710 100644 --- a/dm/pkg/binlog/event/dml.go +++ b/dm/pkg/binlog/event/dml.go @@ -19,7 +19,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/binlog/event/dml_test.go b/dm/pkg/binlog/event/dml_test.go index e7d0b7f0e73..116622653f4 100644 --- a/dm/pkg/binlog/event/dml_test.go +++ b/dm/pkg/binlog/event/dml_test.go @@ -19,7 +19,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/gtid" ) diff --git a/dm/pkg/binlog/event/event.go b/dm/pkg/binlog/event/event.go index c852449c98e..daab72ff7c9 100644 --- a/dm/pkg/binlog/event/event.go +++ b/dm/pkg/binlog/event/event.go @@ -22,7 +22,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/binlog/event/event_test.go b/dm/pkg/binlog/event/event_test.go index 311a63000e1..19ab2066122 100644 --- a/dm/pkg/binlog/event/event_test.go +++ b/dm/pkg/binlog/event/event_test.go @@ -26,7 +26,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/gtid" ) diff --git a/dm/pkg/binlog/event/generator.go b/dm/pkg/binlog/event/generator.go index b9006919edc..a2a4bb2b95c 100644 --- a/dm/pkg/binlog/event/generator.go +++ b/dm/pkg/binlog/event/generator.go @@ -20,7 +20,6 @@ import ( "github.com/coreos/go-semver/semver" gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" - "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/binlog/event/generator_test.go b/dm/pkg/binlog/event/generator_test.go index 58a176b09eb..7ddc6c48a7a 100644 --- a/dm/pkg/binlog/event/generator_test.go +++ b/dm/pkg/binlog/event/generator_test.go @@ -21,7 +21,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/gtid" ) diff --git a/dm/pkg/binlog/event/helper.go b/dm/pkg/binlog/event/helper.go index 9bd4d757073..c1c0c37e32c 100644 --- a/dm/pkg/binlog/event/helper.go +++ b/dm/pkg/binlog/event/helper.go @@ -16,7 +16,6 @@ package event import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" - "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/binlog/event/helper_test.go b/dm/pkg/binlog/event/helper_test.go index 750da640774..b31fe2d3ff6 100644 --- a/dm/pkg/binlog/event/helper_test.go +++ b/dm/pkg/binlog/event/helper_test.go @@ -19,7 +19,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/binlog/event/sid_mysql.go b/dm/pkg/binlog/event/sid_mysql.go index ff2f334eb4e..3a4afbd75b0 100644 --- a/dm/pkg/binlog/event/sid_mysql.go +++ b/dm/pkg/binlog/event/sid_mysql.go @@ -20,7 +20,6 @@ import ( "encoding/hex" "github.com/go-mysql-org/go-mysql/replication" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/binlog/event/util.go b/dm/pkg/binlog/event/util.go index d9e3f91d810..587441a9c7e 100644 --- a/dm/pkg/binlog/event/util.go +++ b/dm/pkg/binlog/event/util.go @@ -32,10 +32,9 @@ import ( "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/parser/charset" "github.com/pingcap/tidb/parser/mysql" + "github.com/pingcap/tiflow/dm/pkg/terror" "golang.org/x/text/encoding" "golang.org/x/text/encoding/simplifiedchinese" - - "github.com/pingcap/tiflow/dm/pkg/terror" ) // encodeTableMapColumnMeta generates the column_meta_def according to the column_type_def. diff --git a/dm/pkg/binlog/event/util_test.go b/dm/pkg/binlog/event/util_test.go index 35d56c8784a..b4bdf768378 100644 --- a/dm/pkg/binlog/event/util_test.go +++ b/dm/pkg/binlog/event/util_test.go @@ -20,9 +20,8 @@ import ( "io" "testing" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/stretchr/testify/require" ) type testCase struct { diff --git a/dm/pkg/binlog/file.go b/dm/pkg/binlog/file.go index 6c2188e9d6a..3fb077387d2 100644 --- a/dm/pkg/binlog/file.go +++ b/dm/pkg/binlog/file.go @@ -17,11 +17,10 @@ import ( "os" "sort" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // ReadSortedBinlogFromDir reads and returns all binlog files (sorted ascending by binlog filename and sequence number). diff --git a/dm/pkg/binlog/pos_finder.go b/dm/pkg/binlog/pos_finder.go index 3706b733c6b..618aae5b678 100644 --- a/dm/pkg/binlog/pos_finder.go +++ b/dm/pkg/binlog/pos_finder.go @@ -19,8 +19,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" "github.com/pingcap/errors" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/binlog/common" "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/binlog/reader" @@ -28,6 +26,7 @@ import ( tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // FakeBinlogName is used to bypass the checking of meta in task config when start-task with --start-time. diff --git a/dm/pkg/binlog/pos_finder_test.go b/dm/pkg/binlog/pos_finder_test.go index 0c86e3f9778..4217345663f 100644 --- a/dm/pkg/binlog/pos_finder_test.go +++ b/dm/pkg/binlog/pos_finder_test.go @@ -25,7 +25,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/binlog/event" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" diff --git a/dm/pkg/binlog/position.go b/dm/pkg/binlog/position.go index abf98132ddd..21eae14c359 100644 --- a/dm/pkg/binlog/position.go +++ b/dm/pkg/binlog/position.go @@ -19,12 +19,11 @@ import ( "strings" gmysql "github.com/go-mysql-org/go-mysql/mysql" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) const ( diff --git a/dm/pkg/binlog/position_test.go b/dm/pkg/binlog/position_test.go index e354348c6ec..4061e2882a0 100644 --- a/dm/pkg/binlog/position_test.go +++ b/dm/pkg/binlog/position_test.go @@ -18,7 +18,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/gtid" ) diff --git a/dm/pkg/binlog/reader/file.go b/dm/pkg/binlog/reader/file.go index b65f2312296..fd2d507e095 100644 --- a/dm/pkg/binlog/reader/file.go +++ b/dm/pkg/binlog/reader/file.go @@ -25,12 +25,11 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" "github.com/pingcap/errors" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/binlog/common" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/atomic" + "go.uber.org/zap" ) // FileReader is a binlog event reader which reads binlog events from a file. diff --git a/dm/pkg/binlog/reader/file_test.go b/dm/pkg/binlog/reader/file_test.go index db72ff28f4a..09295c9760f 100644 --- a/dm/pkg/binlog/reader/file_test.go +++ b/dm/pkg/binlog/reader/file_test.go @@ -25,7 +25,6 @@ import ( "github.com/go-mysql-org/go-mysql/replication" . "github.com/pingcap/check" "github.com/pingcap/errors" - "github.com/pingcap/tiflow/dm/pkg/binlog/common" "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/terror" diff --git a/dm/pkg/binlog/reader/tcp.go b/dm/pkg/binlog/reader/tcp.go index 27c4ed4e9c6..5d2053136f2 100644 --- a/dm/pkg/binlog/reader/tcp.go +++ b/dm/pkg/binlog/reader/tcp.go @@ -20,13 +20,11 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" - "go.uber.org/zap" - "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/pkg/binlog/common" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) // TCPReader is a binlog event reader which read binlog events from a TCP stream. diff --git a/dm/pkg/binlog/reader/tcp_test.go b/dm/pkg/binlog/reader/tcp_test.go index ecf17680e45..acabc04ebf9 100644 --- a/dm/pkg/binlog/reader/tcp_test.go +++ b/dm/pkg/binlog/reader/tcp_test.go @@ -23,7 +23,6 @@ import ( _ "github.com/go-sql-driver/mysql" . "github.com/pingcap/check" "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/pkg/binlog/common" "github.com/pingcap/tiflow/dm/pkg/gtid" ) diff --git a/dm/pkg/binlog/reader/util.go b/dm/pkg/binlog/reader/util.go index 9fbc1e8ff37..81e0156edee 100644 --- a/dm/pkg/binlog/reader/util.go +++ b/dm/pkg/binlog/reader/util.go @@ -20,14 +20,13 @@ import ( "github.com/go-mysql-org/go-mysql/replication" "github.com/pingcap/errors" "github.com/pingcap/failpoint" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/parser" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // GetGTIDsForPosFromStreamer tries to get GTID sets for the specified binlog position (for the corresponding txn) from a Streamer. diff --git a/dm/pkg/binlog/status.go b/dm/pkg/binlog/status.go index fa2368b1aa2..2d9e6dce371 100644 --- a/dm/pkg/binlog/status.go +++ b/dm/pkg/binlog/status.go @@ -18,7 +18,6 @@ import ( "time" gmysql "github.com/go-mysql-org/go-mysql/mysql" - "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/terror" diff --git a/dm/pkg/binlog/status_test.go b/dm/pkg/binlog/status_test.go index 8f13bd00c31..57d3af0f599 100644 --- a/dm/pkg/binlog/status_test.go +++ b/dm/pkg/binlog/status_test.go @@ -19,10 +19,9 @@ import ( "github.com/DATA-DOG/go-sqlmock" gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-sql-driver/mysql" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" + "github.com/stretchr/testify/require" ) func TestGetBinaryLogs(t *testing.T) { diff --git a/dm/pkg/checker/binlog.go b/dm/pkg/checker/binlog.go index ef9797e3bd6..b73cf7e6b64 100644 --- a/dm/pkg/checker/binlog.go +++ b/dm/pkg/checker/binlog.go @@ -20,7 +20,6 @@ import ( "strings" "github.com/pingcap/tidb/util/dbutil" - "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" diff --git a/dm/pkg/checker/binlog_test.go b/dm/pkg/checker/binlog_test.go index e3da3ec8e72..87af512b922 100644 --- a/dm/pkg/checker/binlog_test.go +++ b/dm/pkg/checker/binlog_test.go @@ -18,9 +18,8 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/pingcap/tidb/util/dbutil" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pkg/conn" + "github.com/stretchr/testify/require" ) func TestBinlogDB(t *testing.T) { diff --git a/dm/pkg/checker/mysql_server.go b/dm/pkg/checker/mysql_server.go index 59526d140bb..ae8ea8a0ee1 100644 --- a/dm/pkg/checker/mysql_server.go +++ b/dm/pkg/checker/mysql_server.go @@ -20,7 +20,6 @@ import ( toolsutils "github.com/pingcap/tidb-tools/pkg/utils" "github.com/pingcap/tidb/util/dbutil" - "github.com/pingcap/tiflow/dm/pkg/utils" ) diff --git a/dm/pkg/checker/onlineddl.go b/dm/pkg/checker/onlineddl.go index 242b7fe09bd..897a046f268 100644 --- a/dm/pkg/checker/onlineddl.go +++ b/dm/pkg/checker/onlineddl.go @@ -19,7 +19,6 @@ import ( "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/filter" - onlineddl "github.com/pingcap/tiflow/dm/syncer/online-ddl-tools" ) diff --git a/dm/pkg/checker/privilege.go b/dm/pkg/checker/privilege.go index 9a074daf9aa..1e803cfbaf6 100644 --- a/dm/pkg/checker/privilege.go +++ b/dm/pkg/checker/privilege.go @@ -26,10 +26,9 @@ import ( _ "github.com/pingcap/tidb/types/parser_driver" // for parser driver "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/filter" + "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/pkg/container/sortmap" "go.uber.org/zap" - - "github.com/pingcap/tiflow/dm/pkg/log" ) type tablePriv struct { diff --git a/dm/pkg/checker/table_structure.go b/dm/pkg/checker/table_structure.go index 4d199327722..02ba985eda1 100644 --- a/dm/pkg/checker/table_structure.go +++ b/dm/pkg/checker/table_structure.go @@ -23,9 +23,6 @@ import ( "sync" "time" - "go.uber.org/zap" - "golang.org/x/sync/errgroup" - "github.com/pingcap/errors" "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/parser/ast" @@ -34,9 +31,10 @@ import ( "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/filter" "github.com/pingcap/tidb/util/schemacmp" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" + "golang.org/x/sync/errgroup" ) const ( diff --git a/dm/pkg/conn/baseconn.go b/dm/pkg/conn/baseconn.go index f5cdb86eabc..537d67eedc4 100644 --- a/dm/pkg/conn/baseconn.go +++ b/dm/pkg/conn/baseconn.go @@ -25,14 +25,13 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/tidb/errno" - "github.com/prometheus/client_golang/prometheus" - "go.uber.org/zap" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/retry" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" ) // BaseConn is the basic connection we use in dm diff --git a/dm/pkg/conn/basedb.go b/dm/pkg/conn/basedb.go index ae5b6eac646..31761549729 100644 --- a/dm/pkg/conn/basedb.go +++ b/dm/pkg/conn/basedb.go @@ -27,14 +27,13 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/tidb/util" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/retry" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) var customID int64 diff --git a/dm/pkg/conn/basedb_test.go b/dm/pkg/conn/basedb_test.go index 7d1a43a3458..e78195075a1 100644 --- a/dm/pkg/conn/basedb_test.go +++ b/dm/pkg/conn/basedb_test.go @@ -21,14 +21,12 @@ import ( "testing" "time" - "github.com/phayes/freeport" - "github.com/pingcap/tiflow/dm/pkg/utils" - "github.com/stretchr/testify/require" - "github.com/DATA-DOG/go-sqlmock" - + "github.com/phayes/freeport" "github.com/pingcap/tiflow/dm/config" tcontext "github.com/pingcap/tiflow/dm/pkg/context" + "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/stretchr/testify/require" ) func TestGetBaseConn(t *testing.T) { diff --git a/dm/pkg/conn/mockdb.go b/dm/pkg/conn/mockdb.go index 7121f056088..c298618da5a 100644 --- a/dm/pkg/conn/mockdb.go +++ b/dm/pkg/conn/mockdb.go @@ -29,9 +29,8 @@ import ( "github.com/pingcap/tidb/server" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/store/mockstore" - "github.com/tikv/client-go/v2/testutils" - "github.com/pingcap/tiflow/dm/config" + "github.com/tikv/client-go/v2/testutils" ) type mockDBProvider struct { diff --git a/dm/pkg/conn/utils.go b/dm/pkg/conn/utils.go index 6bbadd35bc4..dc6acfb0d62 100644 --- a/dm/pkg/conn/utils.go +++ b/dm/pkg/conn/utils.go @@ -22,11 +22,10 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/failpoint" tmysql "github.com/pingcap/tidb/parser/mysql" - "go.uber.org/zap" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) const ( diff --git a/dm/pkg/conn/utils_test.go b/dm/pkg/conn/utils_test.go index e031deda12c..af00418674d 100644 --- a/dm/pkg/conn/utils_test.go +++ b/dm/pkg/conn/utils_test.go @@ -18,10 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/stretchr/testify/require" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/stretchr/testify/require" ) func TestGetBinlogDB(t *testing.T) { diff --git a/dm/pkg/dumpling/utils.go b/dm/pkg/dumpling/utils.go index 2e5a9319853..67fbc7201d1 100644 --- a/dm/pkg/dumpling/utils.go +++ b/dm/pkg/dumpling/utils.go @@ -25,14 +25,13 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" brstorage "github.com/pingcap/tidb/br/pkg/storage" "github.com/pingcap/tidb/dumpling/export" - "github.com/spf13/pflag" - "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/storage" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/spf13/pflag" ) // DefaultTableFilter is the default table filter for dumpling. diff --git a/dm/pkg/dumpling/utils_test.go b/dm/pkg/dumpling/utils_test.go index c5efa33df26..f57d25a5434 100644 --- a/dm/pkg/dumpling/utils_test.go +++ b/dm/pkg/dumpling/utils_test.go @@ -23,7 +23,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" . "github.com/pingcap/check" "github.com/pingcap/tidb/dumpling/export" - "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" diff --git a/dm/pkg/election/election.go b/dm/pkg/election/election.go index 7e610ecf1ff..1106ea78726 100644 --- a/dm/pkg/election/election.go +++ b/dm/pkg/election/election.go @@ -23,14 +23,13 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" + "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/pingcap/tiflow/dm/pkg/terror" "go.etcd.io/etcd/api/v3/mvccpb" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" "go.uber.org/atomic" "go.uber.org/zap" - - "github.com/pingcap/tiflow/dm/pkg/log" - "github.com/pingcap/tiflow/dm/pkg/terror" ) const ( diff --git a/dm/pkg/election/election_test.go b/dm/pkg/election/election_test.go index 22bd325962a..75443c99154 100644 --- a/dm/pkg/election/election_test.go +++ b/dm/pkg/election/election_test.go @@ -23,14 +23,13 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/failpoint" - "github.com/tikv/pd/pkg/tempurl" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/embed" - "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/tikv/pd/pkg/tempurl" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/embed" ) var _ = SerialSuites(&testElectionSuite{}) diff --git a/dm/pkg/etcdutil/etcdutil.go b/dm/pkg/etcdutil/etcdutil.go index 199f68db3d0..a8cbec291e6 100644 --- a/dm/pkg/etcdutil/etcdutil.go +++ b/dm/pkg/etcdutil/etcdutil.go @@ -22,17 +22,16 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" - v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/retry" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/pkg/errorutil" + v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) const ( diff --git a/dm/pkg/etcdutil/etcdutil_test.go b/dm/pkg/etcdutil/etcdutil_test.go index ab39cd70f51..e1145a11a83 100644 --- a/dm/pkg/etcdutil/etcdutil_test.go +++ b/dm/pkg/etcdutil/etcdutil_test.go @@ -22,6 +22,8 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/failpoint" + "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/stretchr/testify/require" "github.com/tikv/pd/pkg/tempurl" "go.etcd.io/etcd/api/v3/etcdserverpb" @@ -30,9 +32,6 @@ import ( "go.etcd.io/etcd/client/v3/clientv3util" "go.etcd.io/etcd/server/v3/embed" "go.etcd.io/etcd/tests/v3/integration" - - "github.com/pingcap/tiflow/dm/pkg/log" - "github.com/pingcap/tiflow/dm/pkg/terror" ) var etcdTestSuite = Suite(&testEtcdUtilSuite{}) diff --git a/dm/pkg/func-rollback/rollback.go b/dm/pkg/func-rollback/rollback.go index 3f5935eb6e9..cf838b60fa2 100644 --- a/dm/pkg/func-rollback/rollback.go +++ b/dm/pkg/func-rollback/rollback.go @@ -17,7 +17,6 @@ import ( "sync" "github.com/pingcap/tiflow/dm/pkg/log" - "go.uber.org/zap" ) diff --git a/dm/pkg/gtid/gtid.go b/dm/pkg/gtid/gtid.go index dda2860e635..98075a52d2b 100644 --- a/dm/pkg/gtid/gtid.go +++ b/dm/pkg/gtid/gtid.go @@ -18,7 +18,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/errors" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/ha/bound.go b/dm/pkg/ha/bound.go index 7bb02881030..6155e577d12 100644 --- a/dm/pkg/ha/bound.go +++ b/dm/pkg/ha/bound.go @@ -20,15 +20,14 @@ import ( "time" "github.com/pingcap/failpoint" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) const ( diff --git a/dm/pkg/ha/bound_test.go b/dm/pkg/ha/bound_test.go index 8c31acb7c3c..798c7418053 100644 --- a/dm/pkg/ha/bound_test.go +++ b/dm/pkg/ha/bound_test.go @@ -17,9 +17,8 @@ import ( "context" "time" - "github.com/pingcap/tiflow/dm/config" - . "github.com/pingcap/check" + "github.com/pingcap/tiflow/dm/config" ) func (t *testForEtcd) TestSourceBoundJSON(c *C) { diff --git a/dm/pkg/ha/keepalive.go b/dm/pkg/ha/keepalive.go index 209497ed536..52571fc674b 100644 --- a/dm/pkg/ha/keepalive.go +++ b/dm/pkg/ha/keepalive.go @@ -20,14 +20,13 @@ import ( "sync/atomic" "time" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) var ( diff --git a/dm/pkg/ha/keepalive_test.go b/dm/pkg/ha/keepalive_test.go index 3cbabc701b3..a0d557472d5 100644 --- a/dm/pkg/ha/keepalive_test.go +++ b/dm/pkg/ha/keepalive_test.go @@ -20,9 +20,8 @@ import ( "sync/atomic" "time" - "github.com/pingcap/tiflow/dm/pkg/utils" - . "github.com/pingcap/check" + "github.com/pingcap/tiflow/dm/pkg/utils" ) // keepAliveTTL is set to 0 because the actual ttl is set to minLeaseTTL of etcd diff --git a/dm/pkg/ha/load_task.go b/dm/pkg/ha/load_task.go index 14f949e7dc2..8e663c43c0a 100644 --- a/dm/pkg/ha/load_task.go +++ b/dm/pkg/ha/load_task.go @@ -18,12 +18,11 @@ import ( "encoding/json" "fmt" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" ) // LoadTask uses to watch load worker events. diff --git a/dm/pkg/ha/openapi_task_config.go b/dm/pkg/ha/openapi_task_config.go index 8a7289dbe19..7e109145cc2 100644 --- a/dm/pkg/ha/openapi_task_config.go +++ b/dm/pkg/ha/openapi_task_config.go @@ -16,13 +16,12 @@ package ha import ( "context" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/client/v3/clientv3util" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/openapi" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/terror" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/client/v3/clientv3util" ) func openAPITaskFromResp(resp *clientv3.GetResponse) (*openapi.Task, error) { diff --git a/dm/pkg/ha/openapi_task_config_test.go b/dm/pkg/ha/openapi_task_config_test.go index 9eb518b1ab7..01f46c733c0 100644 --- a/dm/pkg/ha/openapi_task_config_test.go +++ b/dm/pkg/ha/openapi_task_config_test.go @@ -15,7 +15,6 @@ package ha import ( . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/openapi" "github.com/pingcap/tiflow/dm/openapi/fixtures" "github.com/pingcap/tiflow/dm/pkg/terror" diff --git a/dm/pkg/ha/ops.go b/dm/pkg/ha/ops.go index 9f7a90e41b1..7086a19bc0a 100644 --- a/dm/pkg/ha/ops.go +++ b/dm/pkg/ha/ops.go @@ -14,11 +14,10 @@ package ha import ( - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/etcdutil" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" ) // PutRelayStageSourceBound puts the following data in one txn. diff --git a/dm/pkg/ha/ops_test.go b/dm/pkg/ha/ops_test.go index 856f6968edd..c8cbab6d7e7 100644 --- a/dm/pkg/ha/ops_test.go +++ b/dm/pkg/ha/ops_test.go @@ -15,7 +15,6 @@ package ha import ( . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" ) diff --git a/dm/pkg/ha/relay.go b/dm/pkg/ha/relay.go index 09e5c692598..b42b2934042 100644 --- a/dm/pkg/ha/relay.go +++ b/dm/pkg/ha/relay.go @@ -18,15 +18,14 @@ import ( "fmt" "time" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) // RelaySource represents the bound relationship between the DM-worker instance and its upstream relay source. diff --git a/dm/pkg/ha/relay_test.go b/dm/pkg/ha/relay_test.go index 4289f456f43..3145d892644 100644 --- a/dm/pkg/ha/relay_test.go +++ b/dm/pkg/ha/relay_test.go @@ -14,9 +14,8 @@ package ha import ( - "github.com/pingcap/tiflow/dm/config" - . "github.com/pingcap/check" + "github.com/pingcap/tiflow/dm/config" ) func (t *testForEtcd) TestGetRelayConfigEtcd(c *C) { diff --git a/dm/pkg/ha/source.go b/dm/pkg/ha/source.go index ebb9027a56f..85853c49a49 100644 --- a/dm/pkg/ha/source.go +++ b/dm/pkg/ha/source.go @@ -18,12 +18,11 @@ import ( "fmt" "github.com/pingcap/failpoint" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/terror" + clientv3 "go.etcd.io/etcd/client/v3" ) // PutSourceCfg puts the config of the upstream source into etcd. diff --git a/dm/pkg/ha/source_test.go b/dm/pkg/ha/source_test.go index 9cb913d1935..749f5059b11 100644 --- a/dm/pkg/ha/source_test.go +++ b/dm/pkg/ha/source_test.go @@ -22,10 +22,9 @@ import ( "testing" . "github.com/pingcap/check" + "github.com/pingcap/tiflow/dm/config" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/tests/v3/integration" - - "github.com/pingcap/tiflow/dm/config" ) const ( diff --git a/dm/pkg/ha/stage.go b/dm/pkg/ha/stage.go index 24235861422..c210dc9b5f8 100644 --- a/dm/pkg/ha/stage.go +++ b/dm/pkg/ha/stage.go @@ -18,16 +18,15 @@ import ( "encoding/json" "fmt" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) // Stage represents the running stage for a relay or subtask. diff --git a/dm/pkg/ha/stage_test.go b/dm/pkg/ha/stage_test.go index f676bfb7171..94e6474505b 100644 --- a/dm/pkg/ha/stage_test.go +++ b/dm/pkg/ha/stage_test.go @@ -18,7 +18,6 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" ) diff --git a/dm/pkg/ha/subtask.go b/dm/pkg/ha/subtask.go index 11a5b2e4cb4..46dd9f93c21 100644 --- a/dm/pkg/ha/subtask.go +++ b/dm/pkg/ha/subtask.go @@ -16,12 +16,11 @@ package ha import ( "context" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/terror" + clientv3 "go.etcd.io/etcd/client/v3" ) // GetSubTaskCfg gets the subtask config of the specified source and task name. diff --git a/dm/pkg/ha/subtask_test.go b/dm/pkg/ha/subtask_test.go index b371aae2ebe..ebba0744f79 100644 --- a/dm/pkg/ha/subtask_test.go +++ b/dm/pkg/ha/subtask_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/config" ) diff --git a/dm/pkg/ha/task_cli_args.go b/dm/pkg/ha/task_cli_args.go index 640c37445a9..267f8e2c6e4 100644 --- a/dm/pkg/ha/task_cli_args.go +++ b/dm/pkg/ha/task_cli_args.go @@ -17,12 +17,11 @@ import ( "context" "fmt" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/terror" + clientv3 "go.etcd.io/etcd/client/v3" ) func putTaskCliArgsOp(taskname string, sources []string, args config.TaskCliArgs) ([]clientv3.Op, error) { diff --git a/dm/pkg/ha/task_cli_args_test.go b/dm/pkg/ha/task_cli_args_test.go index 654c24788c8..5442f6cee95 100644 --- a/dm/pkg/ha/task_cli_args_test.go +++ b/dm/pkg/ha/task_cli_args_test.go @@ -15,7 +15,6 @@ package ha import ( . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/config" ) diff --git a/dm/pkg/ha/worker.go b/dm/pkg/ha/worker.go index 17b1cd5ced9..3108fc4b52c 100644 --- a/dm/pkg/ha/worker.go +++ b/dm/pkg/ha/worker.go @@ -18,11 +18,10 @@ import ( "encoding/json" "fmt" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/terror" + clientv3 "go.etcd.io/etcd/client/v3" ) // WorkerInfo represents the node information of the DM-worker. diff --git a/dm/pkg/log/log.go b/dm/pkg/log/log.go index 4272391a963..0f0d1197d2d 100644 --- a/dm/pkg/log/log.go +++ b/dm/pkg/log/log.go @@ -21,11 +21,10 @@ import ( "github.com/pingcap/errors" pclog "github.com/pingcap/log" "github.com/pingcap/tidb/util/logutil" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - "github.com/pingcap/tiflow/dm/pkg/helper" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" ) const ( diff --git a/dm/pkg/log/log_test.go b/dm/pkg/log/log_test.go index affde7fd47a..c40c54af9e8 100644 --- a/dm/pkg/log/log_test.go +++ b/dm/pkg/log/log_test.go @@ -22,13 +22,12 @@ import ( "strings" "testing" + . "github.com/pingcap/check" + "github.com/pingcap/errors" "github.com/pingcap/tidb/util/logutil" "go.uber.org/zap" "go.uber.org/zap/zapcore" "go.uber.org/zap/zaptest" - - . "github.com/pingcap/check" - "github.com/pingcap/errors" ) func TestLog(t *testing.T) { diff --git a/dm/pkg/parser/common.go b/dm/pkg/parser/common.go index 8abeea3fda5..0d63db2c807 100644 --- a/dm/pkg/parser/common.go +++ b/dm/pkg/parser/common.go @@ -17,18 +17,16 @@ import ( "bytes" "strings" - "github.com/pingcap/tidb/parser/charset" - - "github.com/pingcap/tiflow/dm/pkg/log" - "github.com/pingcap/tiflow/dm/pkg/terror" - "github.com/pingcap/tiflow/dm/pkg/utils" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/parser/ast" + "github.com/pingcap/tidb/parser/charset" "github.com/pingcap/tidb/parser/format" "github.com/pingcap/tidb/parser/model" _ "github.com/pingcap/tidb/types/parser_driver" // for import parser driver "github.com/pingcap/tidb/util/filter" + "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/pingcap/tiflow/dm/pkg/utils" "go.uber.org/zap" ) diff --git a/dm/pkg/parser/common_test.go b/dm/pkg/parser/common_test.go index 50a39087d04..875fff2f39b 100644 --- a/dm/pkg/parser/common_test.go +++ b/dm/pkg/parser/common_test.go @@ -18,10 +18,9 @@ import ( "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/util/filter" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/stretchr/testify/require" ) type testCase struct { diff --git a/dm/pkg/retry/errors.go b/dm/pkg/retry/errors.go index 01903a424b2..5f4baf33401 100644 --- a/dm/pkg/retry/errors.go +++ b/dm/pkg/retry/errors.go @@ -19,7 +19,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/errors" tmysql "github.com/pingcap/tidb/parser/mysql" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/retry/strategy.go b/dm/pkg/retry/strategy.go index 830f21cb547..5b8d923f9e4 100644 --- a/dm/pkg/retry/strategy.go +++ b/dm/pkg/retry/strategy.go @@ -18,7 +18,6 @@ import ( tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" - "go.uber.org/zap" ) diff --git a/dm/pkg/retry/strategy_test.go b/dm/pkg/retry/strategy_test.go index a4ad96c38c3..9e8253882fb 100644 --- a/dm/pkg/retry/strategy_test.go +++ b/dm/pkg/retry/strategy_test.go @@ -18,11 +18,10 @@ import ( "testing" "time" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" - "github.com/pingcap/tiflow/dm/pkg/terror" - . "github.com/pingcap/check" "github.com/pingcap/tidb/util/dbutil" + tcontext "github.com/pingcap/tiflow/dm/pkg/context" + "github.com/pingcap/tiflow/dm/pkg/terror" ) func TestSuite(t *testing.T) { diff --git a/dm/pkg/schema/tracker.go b/dm/pkg/schema/tracker.go index 7b0fe174692..dfa6c76cde9 100644 --- a/dm/pkg/schema/tracker.go +++ b/dm/pkg/schema/tracker.go @@ -36,9 +36,6 @@ import ( "github.com/pingcap/tidb/util/filter" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/sqlexec" - "go.uber.org/atomic" - "go.uber.org/zap" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" fr "github.com/pingcap/tiflow/dm/pkg/func-rollback" "github.com/pingcap/tiflow/dm/pkg/log" @@ -46,6 +43,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer/dbconn" "github.com/pingcap/tiflow/pkg/sqlmodel" + "go.uber.org/atomic" + "go.uber.org/zap" ) // Tracker is used to track schema locally. diff --git a/dm/pkg/shardddl/optimism/column.go b/dm/pkg/shardddl/optimism/column.go index 06d6ff2d9aa..47bdb637581 100644 --- a/dm/pkg/shardddl/optimism/column.go +++ b/dm/pkg/shardddl/optimism/column.go @@ -16,10 +16,9 @@ package optimism import ( "encoding/json" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" + clientv3 "go.etcd.io/etcd/client/v3" ) // GetAllDroppedColumns gets the all partially dropped columns. diff --git a/dm/pkg/shardddl/optimism/info.go b/dm/pkg/shardddl/optimism/info.go index 922c1852025..cce25c3f32a 100644 --- a/dm/pkg/shardddl/optimism/info.go +++ b/dm/pkg/shardddl/optimism/info.go @@ -20,12 +20,11 @@ import ( "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/util/schemacmp" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" ) // TODO: much of the code in optimistic mode is very similar to pessimistic mode, we can try to combine them together. diff --git a/dm/pkg/shardddl/optimism/info_test.go b/dm/pkg/shardddl/optimism/info_test.go index c1d505ee666..e5f40130f38 100644 --- a/dm/pkg/shardddl/optimism/info_test.go +++ b/dm/pkg/shardddl/optimism/info_test.go @@ -27,11 +27,10 @@ import ( "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/mock" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/tests/v3/integration" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/tests/v3/integration" ) var etcdTestCli *clientv3.Client diff --git a/dm/pkg/shardddl/optimism/keeper_test.go b/dm/pkg/shardddl/optimism/keeper_test.go index 8a972b16414..56aa14f6cbe 100644 --- a/dm/pkg/shardddl/optimism/keeper_test.go +++ b/dm/pkg/shardddl/optimism/keeper_test.go @@ -20,11 +20,10 @@ import ( "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/util/mock" - "go.etcd.io/etcd/tests/v3/integration" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.etcd.io/etcd/tests/v3/integration" ) type testKeeper struct{} diff --git a/dm/pkg/shardddl/optimism/lock.go b/dm/pkg/shardddl/optimism/lock.go index 0a5da7e157c..2e148083e02 100644 --- a/dm/pkg/shardddl/optimism/lock.go +++ b/dm/pkg/shardddl/optimism/lock.go @@ -25,15 +25,14 @@ import ( "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/schemacmp" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "golang.org/x/net/context" - "github.com/pingcap/tiflow/dm/master/metrics" "github.com/pingcap/tiflow/dm/pkg/conn" "github.com/pingcap/tiflow/dm/pkg/cputil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "golang.org/x/net/context" ) // DropColumnStage represents whether drop column done for a sharding table. diff --git a/dm/pkg/shardddl/optimism/lock_test.go b/dm/pkg/shardddl/optimism/lock_test.go index de71d82c32a..e4a50a69659 100644 --- a/dm/pkg/shardddl/optimism/lock_test.go +++ b/dm/pkg/shardddl/optimism/lock_test.go @@ -25,14 +25,13 @@ import ( "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/schemacmp" - "go.etcd.io/etcd/tests/v3/integration" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" "github.com/pingcap/tiflow/dm/pkg/cputil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.etcd.io/etcd/tests/v3/integration" ) type testLock struct{} diff --git a/dm/pkg/shardddl/optimism/operation.go b/dm/pkg/shardddl/optimism/operation.go index 7a8e5eed204..67597d4b6dd 100644 --- a/dm/pkg/shardddl/optimism/operation.go +++ b/dm/pkg/shardddl/optimism/operation.go @@ -17,14 +17,13 @@ import ( "context" "encoding/json" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/client/v3/clientv3util" - "github.com/pingcap/errors" "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/client/v3/clientv3util" ) // ConflictStage represents the current shard DDL conflict stage in the optimistic mode. diff --git a/dm/pkg/shardddl/optimism/ops.go b/dm/pkg/shardddl/optimism/ops.go index bfc6c5060e3..1d3a2adfb28 100644 --- a/dm/pkg/shardddl/optimism/ops.go +++ b/dm/pkg/shardddl/optimism/ops.go @@ -14,10 +14,9 @@ package optimism import ( - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" + clientv3 "go.etcd.io/etcd/client/v3" ) // DeleteInfosOperationsColumns deletes the shard DDL infos, operations, and dropped columns in etcd. diff --git a/dm/pkg/shardddl/optimism/table.go b/dm/pkg/shardddl/optimism/table.go index 731d8770b0e..c1a2de7ee45 100644 --- a/dm/pkg/shardddl/optimism/table.go +++ b/dm/pkg/shardddl/optimism/table.go @@ -18,11 +18,10 @@ import ( "encoding/json" "fmt" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" ) // SourceTables represents the upstream/sources tables for a data migration **subtask**. diff --git a/dm/pkg/shardddl/pessimism/info.go b/dm/pkg/shardddl/pessimism/info.go index 8947be10b7a..fd2324c6930 100644 --- a/dm/pkg/shardddl/pessimism/info.go +++ b/dm/pkg/shardddl/pessimism/info.go @@ -17,13 +17,12 @@ import ( "context" "encoding/json" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/client/v3/clientv3util" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/client/v3/clientv3util" ) // Info represents the shard DDL information. diff --git a/dm/pkg/shardddl/pessimism/info_test.go b/dm/pkg/shardddl/pessimism/info_test.go index 555c319cab2..69e5124f0e6 100644 --- a/dm/pkg/shardddl/pessimism/info_test.go +++ b/dm/pkg/shardddl/pessimism/info_test.go @@ -22,11 +22,10 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/tidb/util/dbutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/tests/v3/integration" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/utils" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/tests/v3/integration" ) var etcdTestCli *clientv3.Client diff --git a/dm/pkg/shardddl/pessimism/lock_test.go b/dm/pkg/shardddl/pessimism/lock_test.go index 322d0c37527..caded63645d 100644 --- a/dm/pkg/shardddl/pessimism/lock_test.go +++ b/dm/pkg/shardddl/pessimism/lock_test.go @@ -15,7 +15,6 @@ package pessimism import ( . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/shardddl/pessimism/operation.go b/dm/pkg/shardddl/pessimism/operation.go index c2d3c7e1173..b935150fe8a 100644 --- a/dm/pkg/shardddl/pessimism/operation.go +++ b/dm/pkg/shardddl/pessimism/operation.go @@ -17,12 +17,11 @@ import ( "context" "encoding/json" + "github.com/pingcap/tiflow/dm/common" + "github.com/pingcap/tiflow/dm/pkg/etcdutil" "go.etcd.io/etcd/api/v3/mvccpb" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/clientv3util" - - "github.com/pingcap/tiflow/dm/common" - "github.com/pingcap/tiflow/dm/pkg/etcdutil" ) // Operation represents a shard DDL coordinate operation. diff --git a/dm/pkg/shardddl/pessimism/ops.go b/dm/pkg/shardddl/pessimism/ops.go index 40ca94f3614..1c4dcce1640 100644 --- a/dm/pkg/shardddl/pessimism/ops.go +++ b/dm/pkg/shardddl/pessimism/ops.go @@ -16,10 +16,9 @@ package pessimism import ( "context" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" + clientv3 "go.etcd.io/etcd/client/v3" ) // TODO(csuzhangxc): assign terror code before merged into the master branch. diff --git a/dm/pkg/storage/utils.go b/dm/pkg/storage/utils.go index 724bb28acab..0311ae9bc91 100644 --- a/dm/pkg/storage/utils.go +++ b/dm/pkg/storage/utils.go @@ -20,11 +20,10 @@ import ( "path/filepath" "strings" - "github.com/pingcap/errors" - bstorage "github.com/pingcap/tidb/br/pkg/storage" - "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/s3" + "github.com/pingcap/errors" + bstorage "github.com/pingcap/tidb/br/pkg/storage" ) // AdjustPath adjust rawURL, add uniqueId as path suffix, returns a new path and will not change rawURL. diff --git a/dm/pkg/upgrade/upgrade.go b/dm/pkg/upgrade/upgrade.go index 82aef7d1945..49023b7bc59 100644 --- a/dm/pkg/upgrade/upgrade.go +++ b/dm/pkg/upgrade/upgrade.go @@ -19,9 +19,6 @@ import ( "time" "github.com/pingcap/tidb/util/dbutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" @@ -30,6 +27,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) // upgrades records all functions used to upgrade from one version to the later version. diff --git a/dm/pkg/upgrade/upgrade_test.go b/dm/pkg/upgrade/upgrade_test.go index d4a895b30fa..0be5e5f1dcd 100644 --- a/dm/pkg/upgrade/upgrade_test.go +++ b/dm/pkg/upgrade/upgrade_test.go @@ -19,10 +19,9 @@ import ( "testing" . "github.com/pingcap/check" + "github.com/pingcap/tiflow/dm/common" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/tests/v3/integration" - - "github.com/pingcap/tiflow/dm/common" ) var ( diff --git a/dm/pkg/upgrade/version.go b/dm/pkg/upgrade/version.go index b7a84f7c7af..afb85db978f 100644 --- a/dm/pkg/upgrade/version.go +++ b/dm/pkg/upgrade/version.go @@ -16,12 +16,11 @@ package upgrade import ( "encoding/json" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/pkg/version" + clientv3 "go.etcd.io/etcd/client/v3" ) const ( diff --git a/dm/pkg/utils/common.go b/dm/pkg/utils/common.go index 79680273805..c21d6d8c813 100644 --- a/dm/pkg/utils/common.go +++ b/dm/pkg/utils/common.go @@ -31,10 +31,9 @@ import ( "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/filter" regexprrouter "github.com/pingcap/tidb/util/regexpr-router" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) func init() { diff --git a/dm/pkg/utils/common_test.go b/dm/pkg/utils/common_test.go index d7ee0f13160..ca57ddaa4ae 100644 --- a/dm/pkg/utils/common_test.go +++ b/dm/pkg/utils/common_test.go @@ -26,9 +26,8 @@ import ( "github.com/pingcap/tidb/util/filter" regexprrouter "github.com/pingcap/tidb/util/regexpr-router" router "github.com/pingcap/tidb/util/table-router" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" + "go.uber.org/zap" ) var _ = Suite(&testCommonSuite{}) diff --git a/dm/pkg/utils/db.go b/dm/pkg/utils/db.go index 19e8d73a163..8a0d24b5aee 100644 --- a/dm/pkg/utils/db.go +++ b/dm/pkg/utils/db.go @@ -31,10 +31,9 @@ import ( "github.com/pingcap/tidb/parser" tmysql "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/util/dbutil" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) const ( diff --git a/dm/pkg/utils/db_test.go b/dm/pkg/utils/db_test.go index 4b9d3845217..20357f1ff46 100644 --- a/dm/pkg/utils/db_test.go +++ b/dm/pkg/utils/db_test.go @@ -26,9 +26,8 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/errors" tmysql "github.com/pingcap/tidb/parser/mysql" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pkg/gtid" + "github.com/stretchr/testify/require" ) var _ = Suite(&testDBSuite{}) diff --git a/dm/pkg/utils/encrypt_test.go b/dm/pkg/utils/encrypt_test.go index e179b5bf114..5cc86a4e67a 100644 --- a/dm/pkg/utils/encrypt_test.go +++ b/dm/pkg/utils/encrypt_test.go @@ -17,7 +17,6 @@ import ( "encoding/base64" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/utils/file.go b/dm/pkg/utils/file.go index eb8956cb16c..476bf1f9de2 100644 --- a/dm/pkg/utils/file.go +++ b/dm/pkg/utils/file.go @@ -22,10 +22,9 @@ import ( "strings" "github.com/docker/go-units" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) // IsFileExists checks if file exists. diff --git a/dm/pkg/utils/file_test.go b/dm/pkg/utils/file_test.go index bdcb49f5c81..c6451d2ae83 100644 --- a/dm/pkg/utils/file_test.go +++ b/dm/pkg/utils/file_test.go @@ -18,7 +18,6 @@ import ( "path/filepath" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/utils/filename.go b/dm/pkg/utils/filename.go index 2c68d001f0a..1d315c7a30c 100644 --- a/dm/pkg/utils/filename.go +++ b/dm/pkg/utils/filename.go @@ -18,10 +18,9 @@ import ( "strconv" "strings" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) const ( diff --git a/dm/pkg/utils/relay.go b/dm/pkg/utils/relay.go index 792d0bca9bd..b9442f1bb32 100644 --- a/dm/pkg/utils/relay.go +++ b/dm/pkg/utils/relay.go @@ -23,7 +23,6 @@ import ( "strings" "github.com/go-mysql-org/go-mysql/replication" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/utils/storage_freebsd.go b/dm/pkg/utils/storage_freebsd.go index a45c1538770..c3f6f86d6f8 100644 --- a/dm/pkg/utils/storage_freebsd.go +++ b/dm/pkg/utils/storage_freebsd.go @@ -19,9 +19,8 @@ package utils import ( "reflect" - "golang.org/x/sys/unix" - "github.com/pingcap/tiflow/dm/pkg/terror" + "golang.org/x/sys/unix" ) // GetStorageSize gets storage's capacity and available size. diff --git a/dm/pkg/utils/storage_unix.go b/dm/pkg/utils/storage_unix.go index 683a19d3f2d..89bfd4d11db 100644 --- a/dm/pkg/utils/storage_unix.go +++ b/dm/pkg/utils/storage_unix.go @@ -19,9 +19,8 @@ package utils import ( "reflect" - "golang.org/x/sys/unix" - "github.com/pingcap/tiflow/dm/pkg/terror" + "golang.org/x/sys/unix" ) // GetStorageSize gets storage's capacity and available size. diff --git a/dm/pkg/utils/time.go b/dm/pkg/utils/time.go index 2b0ad193440..d79fc321d0c 100644 --- a/dm/pkg/utils/time.go +++ b/dm/pkg/utils/time.go @@ -19,7 +19,6 @@ import ( "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/dbutil" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/pkg/utils/util.go b/dm/pkg/utils/util.go index 601226a67af..afb00f41b59 100644 --- a/dm/pkg/utils/util.go +++ b/dm/pkg/utils/util.go @@ -27,11 +27,10 @@ import ( gmysql "github.com/go-sql-driver/mysql" "github.com/pingcap/errors" "github.com/pingcap/tidb/errno" - "go.uber.org/zap" - "golang.org/x/net/http/httpproxy" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" + "golang.org/x/net/http/httpproxy" ) var ( diff --git a/dm/pkg/v1dbschema/schema.go b/dm/pkg/v1dbschema/schema.go index 91369a7873d..e8a07c2da02 100644 --- a/dm/pkg/v1dbschema/schema.go +++ b/dm/pkg/v1dbschema/schema.go @@ -24,8 +24,6 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/util/dbutil" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/binlog/reader" @@ -36,6 +34,7 @@ import ( "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // UpdateSchema updates the DB schema from v1.0.x to v2.0.x, including: diff --git a/dm/pkg/v1dbschema/schema_test.go b/dm/pkg/v1dbschema/schema_test.go index 19b3224aff6..545a3171bd1 100644 --- a/dm/pkg/v1dbschema/schema_test.go +++ b/dm/pkg/v1dbschema/schema_test.go @@ -23,7 +23,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" . "github.com/pingcap/check" "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" diff --git a/dm/pkg/v1workermeta/api.go b/dm/pkg/v1workermeta/api.go index 2cf6eeef88f..b7c7e9a0c9e 100644 --- a/dm/pkg/v1workermeta/api.go +++ b/dm/pkg/v1workermeta/api.go @@ -19,7 +19,6 @@ import ( "strconv" "github.com/BurntSushi/toml" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/terror" diff --git a/dm/pkg/v1workermeta/api_test.go b/dm/pkg/v1workermeta/api_test.go index 6ce2a23f031..125e61d83f2 100644 --- a/dm/pkg/v1workermeta/api_test.go +++ b/dm/pkg/v1workermeta/api_test.go @@ -20,7 +20,6 @@ import ( "runtime" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" diff --git a/dm/pkg/v1workermeta/db.go b/dm/pkg/v1workermeta/db.go index 694f93cd376..fcb9552e927 100644 --- a/dm/pkg/v1workermeta/db.go +++ b/dm/pkg/v1workermeta/db.go @@ -14,10 +14,9 @@ package v1workermeta import ( + "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/opt" - - "github.com/pingcap/tiflow/dm/pkg/terror" ) // kvConfig is the configuration of goleveldb. diff --git a/dm/pkg/v1workermeta/meta.go b/dm/pkg/v1workermeta/meta.go index cf700d16d28..3bcaa44cd8f 100644 --- a/dm/pkg/v1workermeta/meta.go +++ b/dm/pkg/v1workermeta/meta.go @@ -15,11 +15,10 @@ package v1workermeta import ( "github.com/golang/protobuf/proto" - "github.com/syndtr/goleveldb/leveldb" - "github.com/syndtr/goleveldb/leveldb/util" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/syndtr/goleveldb/leveldb" + "github.com/syndtr/goleveldb/leveldb/util" ) // meta stores metadata of tasks. diff --git a/dm/pkg/v1workermeta/meta_test.go b/dm/pkg/v1workermeta/meta_test.go index 45790af3b65..057cf856d4b 100644 --- a/dm/pkg/v1workermeta/meta_test.go +++ b/dm/pkg/v1workermeta/meta_test.go @@ -18,11 +18,10 @@ import ( "testing" . "github.com/pingcap/check" - "github.com/syndtr/goleveldb/leveldb" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/syndtr/goleveldb/leveldb" ) func TestSuite(t *testing.T) { diff --git a/dm/relay/binlog_writer.go b/dm/relay/binlog_writer.go index 17d7c9f73a0..fba7608597a 100644 --- a/dm/relay/binlog_writer.go +++ b/dm/relay/binlog_writer.go @@ -21,11 +21,10 @@ import ( "sync" "github.com/pingcap/errors" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/atomic" + "go.uber.org/zap" ) // BinlogWriter is a binlog event writer which writes binlog events to a file. diff --git a/dm/relay/binlog_writer_test.go b/dm/relay/binlog_writer_test.go index 929f47ce9e3..454265e2055 100644 --- a/dm/relay/binlog_writer_test.go +++ b/dm/relay/binlog_writer_test.go @@ -20,7 +20,6 @@ import ( "strings" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/log" ) diff --git a/dm/relay/file.go b/dm/relay/file.go index 18eb4e8f4ac..933a6adcd58 100644 --- a/dm/relay/file.go +++ b/dm/relay/file.go @@ -17,12 +17,11 @@ import ( "os" "path/filepath" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // FileCmp is a compare condition used when collecting binlog files. diff --git a/dm/relay/file_test.go b/dm/relay/file_test.go index 5a2a86b343d..e3ca803e2d4 100644 --- a/dm/relay/file_test.go +++ b/dm/relay/file_test.go @@ -19,7 +19,6 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/errors" - "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" ) diff --git a/dm/relay/file_util.go b/dm/relay/file_util.go index 55ce55cad5f..73bb55afff1 100644 --- a/dm/relay/file_util.go +++ b/dm/relay/file_util.go @@ -23,7 +23,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" "github.com/pingcap/tidb/parser" - "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/binlog/reader" "github.com/pingcap/tiflow/dm/pkg/gtid" diff --git a/dm/relay/file_util_test.go b/dm/relay/file_util_test.go index a627ad40956..6e0ba22facb 100644 --- a/dm/relay/file_util_test.go +++ b/dm/relay/file_util_test.go @@ -26,7 +26,6 @@ import ( "github.com/pingcap/check" "github.com/pingcap/errors" "github.com/pingcap/tidb/parser" - "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/gtid" ) diff --git a/dm/relay/local_reader.go b/dm/relay/local_reader.go index 4c07abde295..b2f3f248df7 100644 --- a/dm/relay/local_reader.go +++ b/dm/relay/local_reader.go @@ -27,8 +27,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" "github.com/pingcap/errors" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/binlog/reader" @@ -36,6 +34,7 @@ import ( "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // ErrorMaybeDuplicateEvent indicates that there may be duplicate event in next binlog file diff --git a/dm/relay/local_reader_test.go b/dm/relay/local_reader_test.go index a0013645864..0ff4527d3d7 100644 --- a/dm/relay/local_reader_test.go +++ b/dm/relay/local_reader_test.go @@ -34,7 +34,6 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/errors" "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/binlog/reader" "github.com/pingcap/tiflow/dm/pkg/gtid" diff --git a/dm/relay/meta.go b/dm/relay/meta.go index 903a9f96eea..cbfbb7a153a 100644 --- a/dm/relay/meta.go +++ b/dm/relay/meta.go @@ -22,7 +22,6 @@ import ( "github.com/BurntSushi/toml" "github.com/go-mysql-org/go-mysql/mysql" - "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" diff --git a/dm/relay/meta_test.go b/dm/relay/meta_test.go index 39f5fcd72d1..1368f30fa0e 100644 --- a/dm/relay/meta_test.go +++ b/dm/relay/meta_test.go @@ -21,7 +21,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/gtid" ) diff --git a/dm/relay/metrics.go b/dm/relay/metrics.go index 394528590b2..50bcbd909aa 100644 --- a/dm/relay/metrics.go +++ b/dm/relay/metrics.go @@ -18,12 +18,11 @@ import ( "time" "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/engine/pkg/promutil" - "github.com/prometheus/client_golang/prometheus" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/pingcap/tiflow/engine/pkg/promutil" + "github.com/prometheus/client_golang/prometheus" ) var ( diff --git a/dm/relay/purge_strategy.go b/dm/relay/purge_strategy.go index ae0850dd6a0..0eab37f7845 100644 --- a/dm/relay/purge_strategy.go +++ b/dm/relay/purge_strategy.go @@ -18,13 +18,12 @@ import ( "strings" "time" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/streamer" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/atomic" + "go.uber.org/zap" ) type strategyType uint32 diff --git a/dm/relay/purger.go b/dm/relay/purger.go index be0922a0740..d69f6f4e4ac 100644 --- a/dm/relay/purger.go +++ b/dm/relay/purger.go @@ -19,15 +19,14 @@ import ( "sync" "time" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/streamer" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/atomic" + "go.uber.org/zap" ) // Operator represents an operator for relay log files, like writer, reader. diff --git a/dm/relay/purger_helper.go b/dm/relay/purger_helper.go index 1d0b41dbbe9..9e01d011c54 100644 --- a/dm/relay/purger_helper.go +++ b/dm/relay/purger_helper.go @@ -18,12 +18,11 @@ import ( "path/filepath" "time" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/streamer" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // subRelayFiles represents relay log files in one subdirectory. diff --git a/dm/relay/purger_helper_test.go b/dm/relay/purger_helper_test.go index 15434716337..ba47affd288 100644 --- a/dm/relay/purger_helper_test.go +++ b/dm/relay/purger_helper_test.go @@ -19,7 +19,6 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/streamer" "github.com/pingcap/tiflow/dm/pkg/utils" diff --git a/dm/relay/purger_test.go b/dm/relay/purger_test.go index ff0ea768c87..778f1ffdfe3 100644 --- a/dm/relay/purger_test.go +++ b/dm/relay/purger_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/streamer" diff --git a/dm/relay/relay.go b/dm/relay/relay.go index 3c46d6f3e8c..678bbca2ee6 100644 --- a/dm/relay/relay.go +++ b/dm/relay/relay.go @@ -29,9 +29,6 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/util" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" @@ -46,6 +43,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/unit" + "go.uber.org/atomic" + "go.uber.org/zap" ) // used to fill RelayLogInfo. diff --git a/dm/relay/relay_test.go b/dm/relay/relay_test.go index 9b00f729b27..066cd60726a 100644 --- a/dm/relay/relay_test.go +++ b/dm/relay/relay_test.go @@ -31,7 +31,6 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/tidb/parser" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/conn" diff --git a/dm/relay/relay_writer.go b/dm/relay/relay_writer.go index f8fc5ed5244..e300b6bf6f8 100644 --- a/dm/relay/relay_writer.go +++ b/dm/relay/relay_writer.go @@ -20,13 +20,12 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" "github.com/pingcap/failpoint" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/atomic" + "go.uber.org/zap" ) const ( diff --git a/dm/relay/relay_writer_test.go b/dm/relay/relay_writer_test.go index 002c703181e..870bce2b9c7 100644 --- a/dm/relay/relay_writer_test.go +++ b/dm/relay/relay_writer_test.go @@ -23,7 +23,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/log" diff --git a/dm/relay/remote_retry.go b/dm/relay/remote_retry.go index 4c27029c3c6..9848ba021d8 100644 --- a/dm/relay/remote_retry.go +++ b/dm/relay/remote_retry.go @@ -18,7 +18,6 @@ import ( "time" "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/pkg/backoff" "github.com/pingcap/tiflow/dm/pkg/retry" "github.com/pingcap/tiflow/dm/pkg/terror" diff --git a/dm/relay/streamer.go b/dm/relay/streamer.go index 6fa3e552ea7..f48042fb64d 100644 --- a/dm/relay/streamer.go +++ b/dm/relay/streamer.go @@ -18,14 +18,13 @@ import ( "context" "time" + "github.com/go-mysql-org/go-mysql/replication" + "github.com/pingcap/failpoint" "github.com/pingcap/tiflow/dm/pkg/binlog/common" "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" - - "github.com/go-mysql-org/go-mysql/replication" - "github.com/pingcap/failpoint" "go.uber.org/zap" ) diff --git a/dm/relay/streamer_test.go b/dm/relay/streamer_test.go index c280879b7d1..a3da4c386b7 100644 --- a/dm/relay/streamer_test.go +++ b/dm/relay/streamer_test.go @@ -21,7 +21,6 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/errors" "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/relay/upstream_reader.go b/dm/relay/upstream_reader.go index e12c9997f16..5629d5b4500 100644 --- a/dm/relay/upstream_reader.go +++ b/dm/relay/upstream_reader.go @@ -19,12 +19,11 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/binlog/common" "github.com/pingcap/tiflow/dm/pkg/binlog/reader" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) // RResult represents a read operation result. diff --git a/dm/relay/upstream_reader_test.go b/dm/relay/upstream_reader_test.go index 379b2ebd335..022113552eb 100644 --- a/dm/relay/upstream_reader_test.go +++ b/dm/relay/upstream_reader_test.go @@ -20,7 +20,6 @@ import ( "github.com/go-mysql-org/go-mysql/replication" "github.com/pingcap/check" "github.com/pingcap/errors" - "github.com/pingcap/tiflow/dm/pkg/binlog/reader" ) diff --git a/dm/relay/util.go b/dm/relay/util.go index 768840b9706..cffcc343163 100644 --- a/dm/relay/util.go +++ b/dm/relay/util.go @@ -20,7 +20,6 @@ import ( "strings" "github.com/pingcap/errors" - "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" ) diff --git a/dm/relay/util_test.go b/dm/relay/util_test.go index 0ab9790625b..d7553ba413f 100644 --- a/dm/relay/util_test.go +++ b/dm/relay/util_test.go @@ -22,7 +22,6 @@ import ( gmysql "github.com/go-mysql-org/go-mysql/mysql" . "github.com/pingcap/check" "github.com/pingcap/errors" - "github.com/pingcap/tiflow/dm/pkg/conn" "github.com/pingcap/tiflow/dm/pkg/utils" ) diff --git a/dm/simulator/internal/mcp/mcp_test.go b/dm/simulator/internal/mcp/mcp_test.go index 8062479583a..20f6a9016ff 100644 --- a/dm/simulator/internal/mcp/mcp_test.go +++ b/dm/simulator/internal/mcp/mcp_test.go @@ -18,9 +18,8 @@ import ( "sync" "testing" - "github.com/stretchr/testify/suite" - "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/stretchr/testify/suite" ) type testMCPSuite struct { diff --git a/dm/simulator/internal/mcp/uk_test.go b/dm/simulator/internal/mcp/uk_test.go index febc306ff50..4fdfae4233d 100644 --- a/dm/simulator/internal/mcp/uk_test.go +++ b/dm/simulator/internal/mcp/uk_test.go @@ -17,9 +17,8 @@ import ( "sync" "testing" - "github.com/stretchr/testify/suite" - "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/stretchr/testify/suite" ) type testUniqueKeySuite struct { diff --git a/dm/simulator/internal/sqlgen/impl.go b/dm/simulator/internal/sqlgen/impl.go index 20f51c4de80..d37be75b731 100644 --- a/dm/simulator/internal/sqlgen/impl.go +++ b/dm/simulator/internal/sqlgen/impl.go @@ -23,11 +23,10 @@ import ( "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/parser/opcode" _ "github.com/pingcap/tidb/types/parser_driver" // import this to make the parser work - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/simulator/internal/config" "github.com/pingcap/tiflow/dm/simulator/internal/mcp" + "go.uber.org/zap" ) type sqlGeneratorImpl struct { diff --git a/dm/simulator/internal/sqlgen/impl_test.go b/dm/simulator/internal/sqlgen/impl_test.go index 363a77a8867..bad9bd7b92b 100644 --- a/dm/simulator/internal/sqlgen/impl_test.go +++ b/dm/simulator/internal/sqlgen/impl_test.go @@ -20,11 +20,10 @@ import ( "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/parser/ast" - "github.com/stretchr/testify/suite" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/simulator/internal/config" "github.com/pingcap/tiflow/dm/simulator/internal/mcp" + "github.com/stretchr/testify/suite" ) type testSQLGenImplSuite struct { diff --git a/dm/syncer/binlogstream/binlog_locations.go b/dm/syncer/binlogstream/binlog_locations.go index 4f917b2b382..2d53b625330 100644 --- a/dm/syncer/binlogstream/binlog_locations.go +++ b/dm/syncer/binlogstream/binlog_locations.go @@ -18,12 +18,11 @@ import ( "strings" "github.com/go-mysql-org/go-mysql/replication" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/binlog/event" "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/log" + "go.uber.org/zap" ) func isDataEvent(e *replication.BinlogEvent) bool { diff --git a/dm/syncer/binlogstream/streamer_controller.go b/dm/syncer/binlogstream/streamer_controller.go index 033d363dcdc..289ddd9e3c9 100644 --- a/dm/syncer/binlogstream/streamer_controller.go +++ b/dm/syncer/binlogstream/streamer_controller.go @@ -27,16 +27,15 @@ import ( "github.com/go-mysql-org/go-mysql/replication" "github.com/pingcap/failpoint" "github.com/pingcap/tiflow/dm/pb" - "github.com/pingcap/tiflow/dm/pkg/log" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/binlog/reader" tcontext "github.com/pingcap/tiflow/dm/pkg/context" + "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/relay" "github.com/pingcap/tiflow/dm/syncer/dbconn" + "go.uber.org/zap" ) // streamGenerator provides the ability to generate reader.Streamer from diff --git a/dm/syncer/causality.go b/dm/syncer/causality.go index 4fb2e93b4e0..283ebb2a29a 100644 --- a/dm/syncer/causality.go +++ b/dm/syncer/causality.go @@ -17,12 +17,10 @@ import ( "math" "time" - "github.com/pingcap/tiflow/dm/syncer/metrics" - "go.uber.org/zap" - "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/pingcap/tiflow/dm/syncer/metrics" + "go.uber.org/zap" ) // causality provides a simple mechanism to improve the concurrency of SQLs execution under the premise of ensuring correctness. diff --git a/dm/syncer/causality_test.go b/dm/syncer/causality_test.go index b1466d128bd..aa0d14fb718 100644 --- a/dm/syncer/causality_test.go +++ b/dm/syncer/causality_test.go @@ -20,16 +20,15 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/syncer/metrics" - "github.com/stretchr/testify/require" - cdcmodel "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/binlog" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/pingcap/tiflow/dm/syncer/metrics" "github.com/pingcap/tiflow/pkg/sqlmodel" + "github.com/stretchr/testify/require" ) func (s *testSyncerSuite) TestDetectConflict(c *C) { diff --git a/dm/syncer/checkpoint.go b/dm/syncer/checkpoint.go index e419f9dae96..f75f38d2171 100644 --- a/dm/syncer/checkpoint.go +++ b/dm/syncer/checkpoint.go @@ -24,9 +24,13 @@ import ( "sync" "time" + "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/errors" - "github.com/pingcap/tiflow/dm/syncer/metrics" - + "github.com/pingcap/failpoint" + "github.com/pingcap/tidb/parser/model" + tmysql "github.com/pingcap/tidb/parser/mysql" + "github.com/pingcap/tidb/util/dbutil" + "github.com/pingcap/tidb/util/filter" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/conn" @@ -41,13 +45,7 @@ import ( "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer/dbconn" - - "github.com/go-mysql-org/go-mysql/mysql" - "github.com/pingcap/failpoint" - "github.com/pingcap/tidb/parser/model" - tmysql "github.com/pingcap/tidb/parser/mysql" - "github.com/pingcap/tidb/util/dbutil" - "github.com/pingcap/tidb/util/filter" + "github.com/pingcap/tiflow/dm/syncer/metrics" "github.com/uber-go/atomic" "go.uber.org/zap" ) diff --git a/dm/syncer/checkpoint_flush_worker.go b/dm/syncer/checkpoint_flush_worker.go index a8cef3227dc..1b6e3417adf 100644 --- a/dm/syncer/checkpoint_flush_worker.go +++ b/dm/syncer/checkpoint_flush_worker.go @@ -19,11 +19,10 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/tidb/util/filter" - "go.uber.org/atomic" - "go.uber.org/zap" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/atomic" + "go.uber.org/zap" ) type checkpointFlushTask struct { diff --git a/dm/syncer/checkpoint_test.go b/dm/syncer/checkpoint_test.go index c4e4a96605d..5f67256ad6f 100644 --- a/dm/syncer/checkpoint_test.go +++ b/dm/syncer/checkpoint_test.go @@ -24,9 +24,6 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/go-mysql-org/go-mysql/mysql" - "github.com/stretchr/testify/require" - "go.uber.org/zap/zapcore" - . "github.com/pingcap/check" "github.com/pingcap/errors" "github.com/pingcap/log" @@ -45,6 +42,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/schema" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer/dbconn" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zapcore" ) var ( diff --git a/dm/syncer/compactor.go b/dm/syncer/compactor.go index 7afc79901e7..4e9b241e156 100644 --- a/dm/syncer/compactor.go +++ b/dm/syncer/compactor.go @@ -19,11 +19,10 @@ import ( "time" "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/syncer/metrics" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/pingcap/tiflow/dm/syncer/metrics" "github.com/pingcap/tiflow/pkg/sqlmodel" + "go.uber.org/zap" ) // compactor compacts multiple statements into one statement. diff --git a/dm/syncer/data_validator.go b/dm/syncer/data_validator.go index c0a47e4285a..5b7dd187d70 100644 --- a/dm/syncer/data_validator.go +++ b/dm/syncer/data_validator.go @@ -27,9 +27,6 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/util/filter" - "go.uber.org/atomic" - "go.uber.org/zap" - cdcmodel "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" @@ -46,6 +43,8 @@ import ( "github.com/pingcap/tiflow/dm/syncer/metrics" "github.com/pingcap/tiflow/dm/unit" "github.com/pingcap/tiflow/pkg/sqlmodel" + "go.uber.org/atomic" + "go.uber.org/zap" ) const ( diff --git a/dm/syncer/data_validator_test.go b/dm/syncer/data_validator_test.go index 4e336943ee6..64a8dc312ea 100644 --- a/dm/syncer/data_validator_test.go +++ b/dm/syncer/data_validator_test.go @@ -28,9 +28,6 @@ import ( "github.com/pingcap/tidb/util/filter" regexprrouter "github.com/pingcap/tidb/util/regexpr-router" router "github.com/pingcap/tidb/util/table-router" - "github.com/pingcap/tiflow/dm/syncer/binlogstream" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" @@ -42,7 +39,9 @@ import ( "github.com/pingcap/tiflow/dm/pkg/retry" "github.com/pingcap/tiflow/dm/pkg/schema" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/pingcap/tiflow/dm/syncer/binlogstream" "github.com/pingcap/tiflow/dm/syncer/dbconn" + "github.com/stretchr/testify/require" ) func genEventGenerator(t *testing.T) *event.Generator { diff --git a/dm/syncer/dbconn/db.go b/dm/syncer/dbconn/db.go index 1fc7fd79678..3bf7a325e99 100644 --- a/dm/syncer/dbconn/db.go +++ b/dm/syncer/dbconn/db.go @@ -20,9 +20,6 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/tidb/util/dbutil" - "github.com/prometheus/client_golang/prometheus" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" @@ -31,6 +28,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer/metrics" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" ) var retryTimeout = 3 * time.Second diff --git a/dm/syncer/dbconn/upstream_db.go b/dm/syncer/dbconn/upstream_db.go index 53cce4429cc..16024d1de38 100644 --- a/dm/syncer/dbconn/upstream_db.go +++ b/dm/syncer/dbconn/upstream_db.go @@ -22,14 +22,13 @@ import ( "github.com/pingcap/tidb/parser" tmysql "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/util/filter" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // UpStreamConn connect to upstream DB diff --git a/dm/syncer/dbconn/upstream_db_test.go b/dm/syncer/dbconn/upstream_db_test.go index 675e69b2a58..7738938cf48 100644 --- a/dm/syncer/dbconn/upstream_db_test.go +++ b/dm/syncer/dbconn/upstream_db_test.go @@ -22,7 +22,6 @@ import ( "github.com/go-mysql-org/go-mysql/replication" "github.com/google/uuid" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" diff --git a/dm/syncer/ddl_test.go b/dm/syncer/ddl_test.go index 45422ea203a..d91d83e1815 100644 --- a/dm/syncer/ddl_test.go +++ b/dm/syncer/ddl_test.go @@ -26,10 +26,6 @@ import ( "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/parser/ast" "github.com/pingcap/tidb/util/filter" - "github.com/pingcap/tiflow/dm/syncer/metrics" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - regexprrouter "github.com/pingcap/tidb/util/regexpr-router" router "github.com/pingcap/tidb/util/table-router" "github.com/pingcap/tiflow/dm/config" @@ -39,7 +35,10 @@ import ( parserpkg "github.com/pingcap/tiflow/dm/pkg/parser" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/pingcap/tiflow/dm/syncer/metrics" onlineddl "github.com/pingcap/tiflow/dm/syncer/online-ddl-tools" + "github.com/stretchr/testify/require" + "go.uber.org/zap" ) var _ = Suite(&testDDLSuite{}) diff --git a/dm/syncer/dml.go b/dm/syncer/dml.go index c0b330ff37d..614595db7e0 100644 --- a/dm/syncer/dml.go +++ b/dm/syncer/dml.go @@ -22,16 +22,15 @@ import ( "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/parser/types" "github.com/pingcap/tidb/util/filter" - "github.com/shopspring/decimal" - "go.uber.org/zap" - "golang.org/x/text/encoding/charmap" - cdcmodel "github.com/pingcap/tiflow/cdc/model" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/pkg/sqlmodel" + "github.com/shopspring/decimal" + "go.uber.org/zap" + "golang.org/x/text/encoding/charmap" ) // genDMLParam stores original data and table structure. diff --git a/dm/syncer/dml_test.go b/dm/syncer/dml_test.go index 8399f1e3406..5e6c828fc25 100644 --- a/dm/syncer/dml_test.go +++ b/dm/syncer/dml_test.go @@ -18,12 +18,6 @@ import ( "testing" . "github.com/pingcap/check" - "github.com/stretchr/testify/require" - - cdcmodel "github.com/pingcap/tiflow/cdc/model" - "github.com/pingcap/tiflow/dm/pkg/binlog" - "github.com/pingcap/tiflow/pkg/sqlmodel" - tiddl "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/parser/ast" @@ -32,6 +26,10 @@ import ( "github.com/pingcap/tidb/parser/types" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/mock" + cdcmodel "github.com/pingcap/tiflow/cdc/model" + "github.com/pingcap/tiflow/dm/pkg/binlog" + "github.com/pingcap/tiflow/pkg/sqlmodel" + "github.com/stretchr/testify/require" ) var ( diff --git a/dm/syncer/dml_worker.go b/dm/syncer/dml_worker.go index ef8b30c3f9c..7cc2054eadd 100644 --- a/dm/syncer/dml_worker.go +++ b/dm/syncer/dml_worker.go @@ -19,15 +19,14 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/syncer/metrics" - "go.uber.org/zap" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer/dbconn" + "github.com/pingcap/tiflow/dm/syncer/metrics" "github.com/pingcap/tiflow/pkg/sqlmodel" + "go.uber.org/zap" ) // DMLWorker is used to sync dml. diff --git a/dm/syncer/dml_worker_test.go b/dm/syncer/dml_worker_test.go index 38e140915a1..86c7bdd2224 100644 --- a/dm/syncer/dml_worker_test.go +++ b/dm/syncer/dml_worker_test.go @@ -21,10 +21,9 @@ import ( "github.com/pingcap/tidb/parser/ast" timodel "github.com/pingcap/tidb/parser/model" timock "github.com/pingcap/tidb/util/mock" - "github.com/stretchr/testify/require" - cdcmodel "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/pkg/sqlmodel" + "github.com/stretchr/testify/require" ) func mockTableInfo(t *testing.T, sql string) *timodel.TableInfo { diff --git a/dm/syncer/error.go b/dm/syncer/error.go index 0fe212c332c..fed055403e5 100644 --- a/dm/syncer/error.go +++ b/dm/syncer/error.go @@ -30,13 +30,12 @@ import ( tmysql "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/util/dbterror" "github.com/pingcap/tidb/util/dbutil" - "github.com/pingcap/tiflow/dm/pkg/terror" - "go.uber.org/zap" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/syncer/dbconn" "github.com/pingcap/tiflow/pkg/errorutil" + "go.uber.org/zap" ) // ignoreTrackerDDLError is also same with ignoreDDLError, but in order to keep tracker's table structure same as diff --git a/dm/syncer/error_test.go b/dm/syncer/error_test.go index e09291f139f..c6941684d4d 100644 --- a/dm/syncer/error_test.go +++ b/dm/syncer/error_test.go @@ -21,12 +21,11 @@ import ( "github.com/go-sql-driver/mysql" "github.com/pingcap/errors" "github.com/pingcap/tidb/errno" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/syncer/dbconn" "github.com/pingcap/tiflow/dm/syncer/metrics" + "github.com/stretchr/testify/require" ) func newMysqlErr(number uint16, message string) *mysql.MySQLError { diff --git a/dm/syncer/expr_filter_group.go b/dm/syncer/expr_filter_group.go index f1a55831ca7..eea33b47baa 100644 --- a/dm/syncer/expr_filter_group.go +++ b/dm/syncer/expr_filter_group.go @@ -21,12 +21,11 @@ import ( "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/filter" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" + tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // ExprFilterGroup groups many related fields about expression filter. diff --git a/dm/syncer/expr_filter_group_test.go b/dm/syncer/expr_filter_group_test.go index 78362d75cb4..413562a3b28 100644 --- a/dm/syncer/expr_filter_group_test.go +++ b/dm/syncer/expr_filter_group_test.go @@ -18,9 +18,8 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/tidb/util/filter" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" - "github.com/pingcap/tiflow/dm/config" + tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/schema" "github.com/pingcap/tiflow/dm/pkg/utils" diff --git a/dm/syncer/filter.go b/dm/syncer/filter.go index e7fc0fa3189..7ab369df8e5 100644 --- a/dm/syncer/filter.go +++ b/dm/syncer/filter.go @@ -17,11 +17,10 @@ import ( "github.com/go-mysql-org/go-mysql/replication" bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" "github.com/pingcap/tidb/util/filter" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" onlineddl "github.com/pingcap/tiflow/dm/syncer/online-ddl-tools" + "go.uber.org/zap" ) // skipQueryEvent if skip by binlog-filter: diff --git a/dm/syncer/filter_test.go b/dm/syncer/filter_test.go index d6164769139..fdf21482fc0 100644 --- a/dm/syncer/filter_test.go +++ b/dm/syncer/filter_test.go @@ -24,12 +24,11 @@ import ( bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/util/filter" - "github.com/pingcap/tiflow/dm/pkg/binlog" - "github.com/pingcap/tiflow/dm/pkg/log" - "github.com/pingcap/tiflow/dm/config" + "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" + "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/schema" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer/dbconn" diff --git a/dm/syncer/handle_error.go b/dm/syncer/handle_error.go index 53194298276..886620e338f 100644 --- a/dm/syncer/handle_error.go +++ b/dm/syncer/handle_error.go @@ -18,11 +18,9 @@ import ( "encoding/json" "fmt" - "github.com/pingcap/tidb/parser" - "github.com/go-mysql-org/go-mysql/replication" + "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/parser/ast" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" parserpkg "github.com/pingcap/tiflow/dm/pkg/parser" diff --git a/dm/syncer/handle_error_test.go b/dm/syncer/handle_error_test.go index 5e84c068ffb..37fed118237 100644 --- a/dm/syncer/handle_error_test.go +++ b/dm/syncer/handle_error_test.go @@ -18,12 +18,11 @@ import ( "fmt" "testing" - "github.com/pingcap/tiflow/dm/syncer/binlogstream" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/conn" + "github.com/pingcap/tiflow/dm/syncer/binlogstream" "github.com/pingcap/tiflow/dm/syncer/dbconn" + "github.com/stretchr/testify/require" ) func TestHandleError(t *testing.T) { diff --git a/dm/syncer/job.go b/dm/syncer/job.go index 671d2d9d5ba..a89ec2ae7b7 100644 --- a/dm/syncer/job.go +++ b/dm/syncer/job.go @@ -20,7 +20,6 @@ import ( "github.com/go-mysql-org/go-mysql/replication" "github.com/pingcap/tidb/util/filter" - "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/pkg/sqlmodel" ) diff --git a/dm/syncer/job_test.go b/dm/syncer/job_test.go index b70b2a2a081..af072eb0d40 100644 --- a/dm/syncer/job_test.go +++ b/dm/syncer/job_test.go @@ -19,11 +19,10 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" . "github.com/pingcap/check" "github.com/pingcap/tidb/util/filter" - "github.com/stretchr/testify/require" - cdcmodel "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/pkg/sqlmodel" + "github.com/stretchr/testify/require" ) var _ = Suite(&testJobSuite{}) diff --git a/dm/syncer/metrics/validator_metrics.go b/dm/syncer/metrics/validator_metrics.go index 07102f0c488..d446e781248 100644 --- a/dm/syncer/metrics/validator_metrics.go +++ b/dm/syncer/metrics/validator_metrics.go @@ -14,9 +14,8 @@ package metrics import ( - "github.com/prometheus/client_golang/prometheus" - "github.com/pingcap/tiflow/engine/pkg/promutil" + "github.com/prometheus/client_golang/prometheus" ) var defaultFactory = &promutil.PromFactory{} diff --git a/dm/syncer/online-ddl-tools/online_ddl.go b/dm/syncer/online-ddl-tools/online_ddl.go index ab6705f8fdb..663f757519e 100644 --- a/dm/syncer/online-ddl-tools/online_ddl.go +++ b/dm/syncer/online-ddl-tools/online_ddl.go @@ -19,6 +19,12 @@ import ( "regexp" "sync" + "github.com/pingcap/failpoint" + "github.com/pingcap/tidb/parser" + "github.com/pingcap/tidb/parser/ast" + "github.com/pingcap/tidb/parser/model" + "github.com/pingcap/tidb/util/dbutil" + "github.com/pingcap/tidb/util/filter" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" @@ -28,13 +34,6 @@ import ( "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer/dbconn" "github.com/pingcap/tiflow/dm/syncer/metrics" - - "github.com/pingcap/failpoint" - "github.com/pingcap/tidb/parser" - "github.com/pingcap/tidb/parser/ast" - "github.com/pingcap/tidb/parser/model" - "github.com/pingcap/tidb/util/dbutil" - "github.com/pingcap/tidb/util/filter" "go.uber.org/zap" ) diff --git a/dm/syncer/opt_sharding_group.go b/dm/syncer/opt_sharding_group.go index 1a32352e8bc..d87514371ea 100644 --- a/dm/syncer/opt_sharding_group.go +++ b/dm/syncer/opt_sharding_group.go @@ -17,12 +17,11 @@ import ( "sync" "github.com/pingcap/tidb/util/filter" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/binlog" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // OptShardingGroup represents a optimistic sharding DDL sync group. diff --git a/dm/syncer/opt_sharding_group_test.go b/dm/syncer/opt_sharding_group_test.go index c53da0b343e..88ad02cb873 100644 --- a/dm/syncer/opt_sharding_group_test.go +++ b/dm/syncer/opt_sharding_group_test.go @@ -17,9 +17,6 @@ import ( "context" "testing" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/binlog" tcontext "github.com/pingcap/tiflow/dm/pkg/context" @@ -27,6 +24,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/schema" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer/shardddl" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" ) type optShardingGroupSuite struct { diff --git a/dm/syncer/optimist.go b/dm/syncer/optimist.go index 29666c2f5d7..790cae8b30f 100644 --- a/dm/syncer/optimist.go +++ b/dm/syncer/optimist.go @@ -17,9 +17,8 @@ import ( "context" "github.com/pingcap/tidb/util/filter" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // initOptimisticShardDDL initializes the shard DDL support in the optimistic mode. diff --git a/dm/syncer/relay.go b/dm/syncer/relay.go index 93e86186475..dae1e0ed6ae 100644 --- a/dm/syncer/relay.go +++ b/dm/syncer/relay.go @@ -19,13 +19,12 @@ import ( "strings" "github.com/go-mysql-org/go-mysql/mysql" - "github.com/pingcap/tiflow/dm/syncer/binlogstream" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/pingcap/tiflow/dm/syncer/binlogstream" ) func (s *Syncer) setInitActiveRelayLog(ctx context.Context) error { diff --git a/dm/syncer/safe-mode/mode.go b/dm/syncer/safe-mode/mode.go index b84a67e6e24..6a2fe71a345 100644 --- a/dm/syncer/safe-mode/mode.go +++ b/dm/syncer/safe-mode/mode.go @@ -17,11 +17,10 @@ import ( "sync" "github.com/pingcap/tidb/util/filter" - "go.uber.org/zap" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // SafeMode controls whether enable safe-mode through a mechanism similar to reference-count diff --git a/dm/syncer/safe-mode/mode_test.go b/dm/syncer/safe-mode/mode_test.go index df4047cfc5f..7a6f6b54b97 100644 --- a/dm/syncer/safe-mode/mode_test.go +++ b/dm/syncer/safe-mode/mode_test.go @@ -18,7 +18,6 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/tidb/util/filter" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" ) diff --git a/dm/syncer/safe_mode.go b/dm/syncer/safe_mode.go index 41a7b781c3c..c4f435f87ac 100644 --- a/dm/syncer/safe_mode.go +++ b/dm/syncer/safe_mode.go @@ -16,13 +16,12 @@ package syncer import ( "time" - "go.uber.org/zap" - "github.com/pingcap/failpoint" "github.com/pingcap/tiflow/dm/pkg/binlog" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/unit" + "go.uber.org/zap" ) func (s *Syncer) enableSafeModeByTaskCliArgs(tctx *tcontext.Context) { diff --git a/dm/syncer/safe_mode_test.go b/dm/syncer/safe_mode_test.go index 21935de1e64..3db01f59662 100644 --- a/dm/syncer/safe_mode_test.go +++ b/dm/syncer/safe_mode_test.go @@ -17,15 +17,14 @@ import ( "time" "github.com/go-mysql-org/go-mysql/mysql" - "github.com/stretchr/testify/require" - "go.etcd.io/etcd/tests/v3/integration" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/binlog" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" mode "github.com/pingcap/tiflow/dm/syncer/safe-mode" + "github.com/stretchr/testify/require" + "go.etcd.io/etcd/tests/v3/integration" + "go.uber.org/zap" ) type mockCheckpointForSafeMode struct { diff --git a/dm/syncer/schema.go b/dm/syncer/schema.go index 667f492c6d1..954253b4e6c 100644 --- a/dm/syncer/schema.go +++ b/dm/syncer/schema.go @@ -28,15 +28,14 @@ import ( "github.com/pingcap/tidb/parser/format" "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/util/filter" - "github.com/pingcap/tiflow/dm/pkg/utils" - "github.com/pingcap/tiflow/pkg/quotes" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/openapi" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/terror" + "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer/dbconn" + "github.com/pingcap/tiflow/pkg/quotes" + "go.uber.org/zap" ) // OperateSchema operates schema for an upstream table. diff --git a/dm/syncer/shardddl/optimist.go b/dm/syncer/shardddl/optimist.go index f4af5398343..1edd245db54 100644 --- a/dm/syncer/shardddl/optimist.go +++ b/dm/syncer/shardddl/optimist.go @@ -20,14 +20,13 @@ import ( "github.com/pingcap/tidb/parser/model" filter "github.com/pingcap/tidb/util/table-filter" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/shardddl/optimism" "github.com/pingcap/tiflow/dm/pkg/utils" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) // Optimist used to coordinate the shard DDL migration in optimism mode. diff --git a/dm/syncer/shardddl/optimist_test.go b/dm/syncer/shardddl/optimist_test.go index 1847bea33c5..5ae33a074ca 100644 --- a/dm/syncer/shardddl/optimist_test.go +++ b/dm/syncer/shardddl/optimist_test.go @@ -24,7 +24,6 @@ import ( "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/mock" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/shardddl/optimism" "github.com/pingcap/tiflow/dm/pkg/terror" diff --git a/dm/syncer/shardddl/pessimist.go b/dm/syncer/shardddl/pessimist.go index 2bc4f810af2..2011fdd3b4f 100644 --- a/dm/syncer/shardddl/pessimist.go +++ b/dm/syncer/shardddl/pessimist.go @@ -17,14 +17,13 @@ import ( "context" "sync" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/etcdutil" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/shardddl/pessimism" "github.com/pingcap/tiflow/dm/pkg/terror" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" ) // Pessimist used to coordinate the shard DDL migration in pessimism mode. diff --git a/dm/syncer/shardddl/pessimist_test.go b/dm/syncer/shardddl/pessimist_test.go index 35821e10b24..3227b473200 100644 --- a/dm/syncer/shardddl/pessimist_test.go +++ b/dm/syncer/shardddl/pessimist_test.go @@ -19,12 +19,11 @@ import ( "time" . "github.com/pingcap/check" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/tests/v3/integration" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/shardddl/pessimism" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/tests/v3/integration" ) var etcdTestCli *clientv3.Client diff --git a/dm/syncer/sharding-meta/shardmeta.go b/dm/syncer/sharding-meta/shardmeta.go index 0d93173c92e..e0cd6629826 100644 --- a/dm/syncer/sharding-meta/shardmeta.go +++ b/dm/syncer/sharding-meta/shardmeta.go @@ -20,13 +20,12 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/filter" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // DDLItem records ddl information used in sharding sequence organization. diff --git a/dm/syncer/sharding-meta/shardmeta_test.go b/dm/syncer/sharding-meta/shardmeta_test.go index d861fad6465..a662e904d78 100644 --- a/dm/syncer/sharding-meta/shardmeta_test.go +++ b/dm/syncer/sharding-meta/shardmeta_test.go @@ -19,7 +19,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/binlog" ) diff --git a/dm/syncer/sharding_group.go b/dm/syncer/sharding_group.go index a2291a77e58..0c8abda0e9d 100644 --- a/dm/syncer/sharding_group.go +++ b/dm/syncer/sharding_group.go @@ -74,6 +74,8 @@ import ( "fmt" "sync" + "github.com/pingcap/tidb/util/dbutil" + "github.com/pingcap/tidb/util/filter" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" @@ -86,9 +88,6 @@ import ( "github.com/pingcap/tiflow/dm/syncer/dbconn" "github.com/pingcap/tiflow/dm/syncer/metrics" shardmeta "github.com/pingcap/tiflow/dm/syncer/sharding-meta" - - "github.com/pingcap/tidb/util/dbutil" - "github.com/pingcap/tidb/util/filter" "go.uber.org/zap" ) diff --git a/dm/syncer/sharding_group_test.go b/dm/syncer/sharding_group_test.go index fdecc15953b..3034f34882c 100644 --- a/dm/syncer/sharding_group_test.go +++ b/dm/syncer/sharding_group_test.go @@ -23,7 +23,6 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/filter" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" diff --git a/dm/syncer/status.go b/dm/syncer/status.go index dc33ed3be57..c4b69e9314d 100644 --- a/dm/syncer/status.go +++ b/dm/syncer/status.go @@ -16,16 +16,14 @@ package syncer import ( "time" - "go.uber.org/zap" - "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/shardddl/optimism" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // Status implements Unit.Status. diff --git a/dm/syncer/status_test.go b/dm/syncer/status_test.go index a2e379de343..8ed468d9ba4 100644 --- a/dm/syncer/status_test.go +++ b/dm/syncer/status_test.go @@ -20,15 +20,14 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/util/filter" - "github.com/pingcap/tiflow/dm/syncer/metrics" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/pingcap/tiflow/dm/syncer/metrics" "github.com/pingcap/tiflow/dm/syncer/shardddl" + "go.uber.org/zap" ) var _ = Suite(&statusSuite{}) diff --git a/dm/syncer/syncer.go b/dm/syncer/syncer.go index 0340489242f..f9d897cddb4 100644 --- a/dm/syncer/syncer.go +++ b/dm/syncer/syncer.go @@ -41,10 +41,6 @@ import ( "github.com/pingcap/tidb/util/filter" regexprrouter "github.com/pingcap/tidb/util/regexpr-router" router "github.com/pingcap/tidb/util/table-router" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" @@ -73,6 +69,9 @@ import ( "github.com/pingcap/tiflow/dm/unit" "github.com/pingcap/tiflow/pkg/errorutil" "github.com/pingcap/tiflow/pkg/sqlmodel" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/atomic" + "go.uber.org/zap" ) var ( diff --git a/dm/syncer/syncer_test.go b/dm/syncer/syncer_test.go index 8443f5d7063..c11fa9e47cc 100644 --- a/dm/syncer/syncer_test.go +++ b/dm/syncer/syncer_test.go @@ -25,6 +25,21 @@ import ( "testing" "time" + sqlmock "github.com/DATA-DOG/go-sqlmock" + "github.com/go-mysql-org/go-mysql/mysql" + "github.com/go-mysql-org/go-mysql/replication" + _ "github.com/go-sql-driver/mysql" + . "github.com/pingcap/check" + "github.com/pingcap/failpoint" + bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" + cm "github.com/pingcap/tidb-tools/pkg/column-mapping" + "github.com/pingcap/tidb/infoschema" + "github.com/pingcap/tidb/parser" + "github.com/pingcap/tidb/parser/ast" + pmysql "github.com/pingcap/tidb/parser/mysql" + "github.com/pingcap/tidb/util/filter" + regexprrouter "github.com/pingcap/tidb/util/regexpr-router" + router "github.com/pingcap/tidb/util/table-router" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" @@ -46,22 +61,6 @@ import ( "github.com/pingcap/tiflow/pkg/errorutil" "github.com/pingcap/tiflow/pkg/sqlmodel" "github.com/stretchr/testify/require" - - sqlmock "github.com/DATA-DOG/go-sqlmock" - "github.com/go-mysql-org/go-mysql/mysql" - "github.com/go-mysql-org/go-mysql/replication" - _ "github.com/go-sql-driver/mysql" - . "github.com/pingcap/check" - "github.com/pingcap/failpoint" - bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" - cm "github.com/pingcap/tidb-tools/pkg/column-mapping" - "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/parser" - "github.com/pingcap/tidb/parser/ast" - pmysql "github.com/pingcap/tidb/parser/mysql" - "github.com/pingcap/tidb/util/filter" - regexprrouter "github.com/pingcap/tidb/util/regexpr-router" - router "github.com/pingcap/tidb/util/table-router" "go.uber.org/zap" ) diff --git a/dm/syncer/test_injector.go b/dm/syncer/test_injector.go index 0f77839b889..181db771cdd 100644 --- a/dm/syncer/test_injector.go +++ b/dm/syncer/test_injector.go @@ -14,10 +14,9 @@ package syncer import ( - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/zap" ) // TestInjector is used to support inject test cases into syncer. diff --git a/dm/syncer/util.go b/dm/syncer/util.go index 17e1fcac547..1cc0eb32fb1 100644 --- a/dm/syncer/util.go +++ b/dm/syncer/util.go @@ -27,15 +27,14 @@ import ( "github.com/pingcap/tidb/parser/ast" "github.com/pingcap/tidb/util" "github.com/pingcap/tidb/util/filter" - "github.com/pingcap/tiflow/dm/syncer/dbconn" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/binlog/common" "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/pingcap/tiflow/dm/syncer/dbconn" + "go.uber.org/zap" ) // the time layout for TiDB SHOW DDL statements. diff --git a/dm/syncer/validate_worker.go b/dm/syncer/validate_worker.go index a4cde6f22e0..7c79d291ed1 100644 --- a/dm/syncer/validate_worker.go +++ b/dm/syncer/validate_worker.go @@ -32,9 +32,6 @@ import ( tidbmysql "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/filter" - "go.uber.org/atomic" - "go.uber.org/zap" - cdcmodel "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" @@ -43,6 +40,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/pkg/sqlmodel" + "go.uber.org/atomic" + "go.uber.org/zap" ) const ( diff --git a/dm/syncer/validate_worker_test.go b/dm/syncer/validate_worker_test.go index 50bf6c918ee..9421afd27c4 100644 --- a/dm/syncer/validate_worker_test.go +++ b/dm/syncer/validate_worker_test.go @@ -28,13 +28,12 @@ import ( "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/parser/types" "github.com/pingcap/tidb/util/filter" - "github.com/stretchr/testify/require" - cdcmodel "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/pkg/sqlmodel" + "github.com/stretchr/testify/require" ) func genRowChangeJob(tbl filter.Table, tblInfo *model.TableInfo, key string, tp rowChangeJobType, data []interface{}) *rowValidationJob { diff --git a/dm/syncer/validator_checkpoint.go b/dm/syncer/validator_checkpoint.go index d194b1a360d..cc1dbe05093 100644 --- a/dm/syncer/validator_checkpoint.go +++ b/dm/syncer/validator_checkpoint.go @@ -26,9 +26,6 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/tidb/util/dbutil" "github.com/pingcap/tidb/util/filter" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" @@ -38,6 +35,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/gtid" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/retry" + "go.uber.org/atomic" + "go.uber.org/zap" ) const ( diff --git a/dm/syncer/validator_checkpoint_test.go b/dm/syncer/validator_checkpoint_test.go index 45db4b3c5f3..4bc76ef6d8d 100644 --- a/dm/syncer/validator_checkpoint_test.go +++ b/dm/syncer/validator_checkpoint_test.go @@ -27,15 +27,14 @@ import ( "github.com/pingcap/tidb/util/filter" regexprrouter "github.com/pingcap/tidb/util/regexpr-router" router "github.com/pingcap/tidb/util/table-router" - "github.com/pingcap/tiflow/dm/pkg/log" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/conn" + "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/retry" "github.com/pingcap/tiflow/dm/pkg/schema" "github.com/pingcap/tiflow/dm/syncer/dbconn" + "github.com/stretchr/testify/require" ) func TestValidatorCheckpointPersist(t *testing.T) { diff --git a/dm/tests/_dmctl_tools/check_exit_safe_binlog.go b/dm/tests/_dmctl_tools/check_exit_safe_binlog.go index c114de2d527..612343b883b 100644 --- a/dm/tests/_dmctl_tools/check_exit_safe_binlog.go +++ b/dm/tests/_dmctl_tools/check_exit_safe_binlog.go @@ -20,7 +20,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" _ "github.com/go-sql-driver/mysql" - "github.com/pingcap/errors" "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/gtid" diff --git a/dm/tests/_dmctl_tools/check_master_http_apis.go b/dm/tests/_dmctl_tools/check_master_http_apis.go index 5f4995fb878..20ed8de1ed3 100644 --- a/dm/tests/_dmctl_tools/check_master_http_apis.go +++ b/dm/tests/_dmctl_tools/check_master_http_apis.go @@ -19,9 +19,8 @@ import ( "net/http" "os" - "github.com/pingcap/tiflow/dm/tests/utils" - toolutils "github.com/pingcap/tidb-tools/pkg/utils" + "github.com/pingcap/tiflow/dm/tests/utils" ) // use show-ddl-locks request to test DM-master is online diff --git a/dm/tests/_dmctl_tools/check_master_online.go b/dm/tests/_dmctl_tools/check_master_online.go index 47f47aac4f4..f58587216d7 100644 --- a/dm/tests/_dmctl_tools/check_master_online.go +++ b/dm/tests/_dmctl_tools/check_master_online.go @@ -18,12 +18,10 @@ import ( "os" "time" - "google.golang.org/grpc" - toolutils "github.com/pingcap/tidb-tools/pkg/utils" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/tests/utils" + "google.golang.org/grpc" ) // use show-ddl-locks request to test DM-master is online diff --git a/dm/tests/_dmctl_tools/check_master_online_http.go b/dm/tests/_dmctl_tools/check_master_online_http.go index cdfee1ebc76..2b5449d6c2b 100644 --- a/dm/tests/_dmctl_tools/check_master_online_http.go +++ b/dm/tests/_dmctl_tools/check_master_online_http.go @@ -19,9 +19,8 @@ import ( "net/http" "os" - "github.com/pingcap/tiflow/dm/tests/utils" - toolutils "github.com/pingcap/tidb-tools/pkg/utils" + "github.com/pingcap/tiflow/dm/tests/utils" ) // use show-ddl-locks request to test DM-master is online diff --git a/dm/tests/_dmctl_tools/check_worker_online.go b/dm/tests/_dmctl_tools/check_worker_online.go index 8dfd6c70675..a9485ff66be 100644 --- a/dm/tests/_dmctl_tools/check_worker_online.go +++ b/dm/tests/_dmctl_tools/check_worker_online.go @@ -18,12 +18,10 @@ import ( "os" "time" - "google.golang.org/grpc" - toolutils "github.com/pingcap/tidb-tools/pkg/utils" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/tests/utils" + "google.golang.org/grpc" ) // use query status request to test DM-worker is online diff --git a/dm/tests/utils/dmctl.go b/dm/tests/utils/dmctl.go index cf878d32365..b62cc4672fa 100644 --- a/dm/tests/utils/dmctl.go +++ b/dm/tests/utils/dmctl.go @@ -20,9 +20,8 @@ import ( "time" "github.com/pingcap/errors" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/dm/pb" + "google.golang.org/grpc" ) // CreateDmCtl creates a gRPC client to DM-master. diff --git a/dm/tests/utils/log.go b/dm/tests/utils/log.go index 051ce709931..8b3d9b6a18a 100644 --- a/dm/tests/utils/log.go +++ b/dm/tests/utils/log.go @@ -16,9 +16,8 @@ package utils import ( "os" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" + "go.uber.org/zap" ) // ExitWithError forces to exist the process, it's often used in integration tests. diff --git a/dm/unit/unit_test.go b/dm/unit/unit_test.go index bfba07e9649..607211c7fbe 100644 --- a/dm/unit/unit_test.go +++ b/dm/unit/unit_test.go @@ -19,7 +19,6 @@ import ( "github.com/pingcap/check" "github.com/pingcap/errors" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/worker/config.go b/dm/worker/config.go index 164e34fcf51..9ea225ac6e7 100644 --- a/dm/worker/config.go +++ b/dm/worker/config.go @@ -24,7 +24,6 @@ import ( "github.com/BurntSushi/toml" "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" diff --git a/dm/worker/config_test.go b/dm/worker/config_test.go index 30ccc607484..92a15e70c7f 100644 --- a/dm/worker/config_test.go +++ b/dm/worker/config_test.go @@ -20,7 +20,6 @@ import ( "github.com/kami-zh/go-capturer" "github.com/pingcap/check" - "github.com/pingcap/tiflow/dm/pkg/terror" ) diff --git a/dm/worker/join.go b/dm/worker/join.go index 3f6c8b480a6..104e2a1f47b 100644 --- a/dm/worker/join.go +++ b/dm/worker/join.go @@ -20,14 +20,13 @@ import ( "github.com/pingcap/failpoint" toolutils "github.com/pingcap/tidb-tools/pkg/utils" - "go.uber.org/zap" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/ha" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" + "google.golang.org/grpc" ) // GetJoinURLs gets the endpoints from the join address. diff --git a/dm/worker/metrics.go b/dm/worker/metrics.go index 5e241903978..ac2e620e471 100644 --- a/dm/worker/metrics.go +++ b/dm/worker/metrics.go @@ -21,18 +21,17 @@ import ( "time" cpu "github.com/pingcap/tidb-tools/pkg/utils" - "github.com/pingcap/tiflow/dm/syncer/metrics" - "github.com/pingcap/tiflow/engine/pkg/promutil" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/collectors" - "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/dumpling" "github.com/pingcap/tiflow/dm/loader" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/relay" + "github.com/pingcap/tiflow/dm/syncer/metrics" + "github.com/pingcap/tiflow/engine/pkg/promutil" "github.com/pingcap/tiflow/pkg/version" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/collectors" + "github.com/prometheus/client_golang/prometheus/promhttp" ) const ( diff --git a/dm/worker/relay.go b/dm/worker/relay.go index 551023c0457..5515368ff00 100644 --- a/dm/worker/relay.go +++ b/dm/worker/relay.go @@ -18,9 +18,6 @@ import ( "sync" "github.com/pingcap/errors" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" @@ -28,6 +25,8 @@ import ( "github.com/pingcap/tiflow/dm/pkg/streamer" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/relay" + "go.uber.org/atomic" + "go.uber.org/zap" ) // RelayHolder for relay unit. diff --git a/dm/worker/relay_test.go b/dm/worker/relay_test.go index 1494b64501c..14c7e721d42 100644 --- a/dm/worker/relay_test.go +++ b/dm/worker/relay_test.go @@ -20,7 +20,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" . "github.com/pingcap/check" "github.com/pingcap/errors" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" diff --git a/dm/worker/server.go b/dm/worker/server.go index 62c937f16aa..6dc6c50ad38 100644 --- a/dm/worker/server.go +++ b/dm/worker/server.go @@ -20,6 +20,8 @@ import ( "sync" "time" + "github.com/pingcap/errors" + toolutils "github.com/pingcap/tidb-tools/pkg/utils" "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" @@ -32,9 +34,6 @@ import ( "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer" "github.com/pingcap/tiflow/dm/unit" - - "github.com/pingcap/errors" - toolutils "github.com/pingcap/tidb-tools/pkg/utils" "github.com/soheilhy/cmux" clientv3 "go.etcd.io/etcd/client/v3" "go.uber.org/atomic" diff --git a/dm/worker/server_test.go b/dm/worker/server_test.go index 1607d40f838..2b9e99e291a 100644 --- a/dm/worker/server_test.go +++ b/dm/worker/server_test.go @@ -26,13 +26,6 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/errors" "github.com/pingcap/failpoint" - "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/tempurl" - v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/embed" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" @@ -43,6 +36,12 @@ import ( "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/relay" "github.com/pingcap/tiflow/dm/unit" + "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/tempurl" + v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/embed" + "google.golang.org/grpc" ) // do not forget to update this path if the file removed/renamed. diff --git a/dm/worker/source_worker.go b/dm/worker/source_worker.go index 79f28dfbf87..f2b62b0303a 100644 --- a/dm/worker/source_worker.go +++ b/dm/worker/source_worker.go @@ -24,10 +24,6 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/failpoint" bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" @@ -39,6 +35,9 @@ import ( "github.com/pingcap/tiflow/dm/pkg/streamer" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/relay" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/atomic" + "go.uber.org/zap" ) // SourceWorker manages a source(upstream) which is mainly related to subtasks and relay. diff --git a/dm/worker/source_worker_test.go b/dm/worker/source_worker_test.go index 4674400441a..1b2a9da6f98 100644 --- a/dm/worker/source_worker_test.go +++ b/dm/worker/source_worker_test.go @@ -25,10 +25,6 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/errors" "github.com/pingcap/failpoint" - "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/tempurl" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/conn" @@ -39,6 +35,9 @@ import ( "github.com/pingcap/tiflow/dm/relay" "github.com/pingcap/tiflow/dm/syncer" "github.com/pingcap/tiflow/dm/unit" + "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/tempurl" + clientv3 "go.etcd.io/etcd/client/v3" ) var emptyWorkerStatusInfoJSONLength = 25 diff --git a/dm/worker/status.go b/dm/worker/status.go index ef1a9be2ea4..cfb83c1ac84 100644 --- a/dm/worker/status.go +++ b/dm/worker/status.go @@ -18,11 +18,10 @@ import ( "sort" "github.com/gogo/protobuf/jsonpb" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/common" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" + "go.uber.org/zap" ) // Status returns the status of the current sub task. diff --git a/dm/worker/subtask.go b/dm/worker/subtask.go index 5dccbfe59ab..f19441fc70f 100644 --- a/dm/worker/subtask.go +++ b/dm/worker/subtask.go @@ -20,11 +20,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/failpoint" - "github.com/prometheus/client_golang/prometheus" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/dumpling" "github.com/pingcap/tiflow/dm/loader" @@ -38,6 +33,10 @@ import ( "github.com/pingcap/tiflow/dm/relay" "github.com/pingcap/tiflow/dm/syncer" "github.com/pingcap/tiflow/dm/unit" + "github.com/prometheus/client_golang/prometheus" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/atomic" + "go.uber.org/zap" ) const ( diff --git a/dm/worker/subtask_test.go b/dm/worker/subtask_test.go index bf537b4d90c..6b1eef9f693 100644 --- a/dm/worker/subtask_test.go +++ b/dm/worker/subtask_test.go @@ -22,9 +22,6 @@ import ( "github.com/go-mysql-org/go-mysql/mysql" . "github.com/pingcap/check" "github.com/pingcap/errors" - "github.com/stretchr/testify/require" - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/dumpling" "github.com/pingcap/tiflow/dm/loader" @@ -35,6 +32,8 @@ import ( "github.com/pingcap/tiflow/dm/relay" "github.com/pingcap/tiflow/dm/syncer" "github.com/pingcap/tiflow/dm/unit" + "github.com/stretchr/testify/require" + clientv3 "go.etcd.io/etcd/client/v3" ) const ( diff --git a/dm/worker/task_checker.go b/dm/worker/task_checker.go index ae32122d2ff..8376bc4e4db 100644 --- a/dm/worker/task_checker.go +++ b/dm/worker/task_checker.go @@ -21,15 +21,14 @@ import ( "time" "github.com/pingcap/failpoint" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/backoff" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/retry" "github.com/pingcap/tiflow/dm/pkg/terror" + "go.uber.org/atomic" + "go.uber.org/zap" ) // Backoff related constants diff --git a/dm/worker/task_checker_test.go b/dm/worker/task_checker_test.go index 0c954423957..8b879b63ddd 100644 --- a/dm/worker/task_checker_test.go +++ b/dm/worker/task_checker_test.go @@ -20,15 +20,14 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/tidb/br/pkg/lightning/common" tmysql "github.com/pingcap/tidb/parser/mysql" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/backoff" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/pingcap/tiflow/dm/unit" + "github.com/stretchr/testify/require" + "go.uber.org/zap" ) var ( diff --git a/dm/worker/utils.go b/dm/worker/utils.go index 81b45d5aa1d..729a13cdb68 100644 --- a/dm/worker/utils.go +++ b/dm/worker/utils.go @@ -14,11 +14,10 @@ package worker import ( - clientv3 "go.etcd.io/etcd/client/v3" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/ha" + clientv3 "go.etcd.io/etcd/client/v3" ) func getExpectValidatorStage(cfg config.ValidatorConfig, etcdClient *clientv3.Client, source, task string, revision int64) (pb.Stage, error) { diff --git a/dm/worker/utils_test.go b/dm/worker/utils_test.go index 7069b6e5168..8e76766b975 100644 --- a/dm/worker/utils_test.go +++ b/dm/worker/utils_test.go @@ -16,12 +16,11 @@ package worker import ( "testing" - "github.com/stretchr/testify/require" - "go.etcd.io/etcd/tests/v3/integration" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/ha" + "github.com/stretchr/testify/require" + "go.etcd.io/etcd/tests/v3/integration" ) func TestGetExpectValidatorStage(t *testing.T) { diff --git a/dm/worker/v1meta.go b/dm/worker/v1meta.go index bcdbf8b04ab..744e8145f82 100644 --- a/dm/worker/v1meta.go +++ b/dm/worker/v1meta.go @@ -17,11 +17,10 @@ import ( "context" "fmt" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/v1workermeta" + "go.uber.org/zap" ) // OperateV1Meta implements WorkerServer.OperateV1Meta. diff --git a/engine/chaos/cases/case_fake_job.go b/engine/chaos/cases/case_fake_job.go index 9e9a44d855c..bd72510b479 100644 --- a/engine/chaos/cases/case_fake_job.go +++ b/engine/chaos/cases/case_fake_job.go @@ -21,14 +21,13 @@ import ( "time" "github.com/pingcap/log" - "go.uber.org/zap" - pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/framework/fake" "github.com/pingcap/tiflow/engine/pkg/tenant" "github.com/pingcap/tiflow/engine/test/e2e" "github.com/pingcap/tiflow/pkg/retry" "github.com/pingcap/tiflow/pkg/util" + "go.uber.org/zap" ) func runFakeJobCase(ctx context.Context, cfg *config) error { diff --git a/engine/executor/cvs/cvstask.go b/engine/executor/cvs/cvstask.go index c733be67cc2..4e5e72f832b 100644 --- a/engine/executor/cvs/cvstask.go +++ b/engine/executor/cvs/cvstask.go @@ -21,11 +21,6 @@ import ( "time" "github.com/pingcap/log" - "go.uber.org/atomic" - "go.uber.org/zap" - "golang.org/x/time/rate" - "google.golang.org/grpc" - pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/framework" frameModel "github.com/pingcap/tiflow/engine/framework/model" @@ -34,6 +29,10 @@ import ( dcontext "github.com/pingcap/tiflow/engine/pkg/context" "github.com/pingcap/tiflow/engine/pkg/p2p" "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/atomic" + "go.uber.org/zap" + "golang.org/x/time/rate" + "google.golang.org/grpc" ) const ( diff --git a/engine/executor/dm/unitholder.go b/engine/executor/dm/unitholder.go index 66140a51d26..d856675f8ef 100644 --- a/engine/executor/dm/unitholder.go +++ b/engine/executor/dm/unitholder.go @@ -19,9 +19,6 @@ import ( "time" "github.com/pingcap/errors" - "github.com/pingcap/tiflow/dm/pkg/utils" - "go.uber.org/zap" - dmconfig "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/dumpling" "github.com/pingcap/tiflow/dm/loader" @@ -30,12 +27,14 @@ import ( "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" "github.com/pingcap/tiflow/dm/pkg/log" + "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/dm/syncer" "github.com/pingcap/tiflow/dm/unit" "github.com/pingcap/tiflow/engine/framework" frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/jobmaster/dm/metadata" dmpkg "github.com/pingcap/tiflow/engine/pkg/dm" + "go.uber.org/zap" ) // unitHolder hold a unit of DM diff --git a/engine/executor/dm/unitholder_test.go b/engine/executor/dm/unitholder_test.go index ca334c3001e..7aac7bb404d 100644 --- a/engine/executor/dm/unitholder_test.go +++ b/engine/executor/dm/unitholder_test.go @@ -23,19 +23,18 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/go-mysql-org/go-mysql/mysql" - "github.com/pingcap/tiflow/dm/pkg/log" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/dumpling" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/binlog" "github.com/pingcap/tiflow/dm/pkg/conn" + "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/syncer" "github.com/pingcap/tiflow/engine/jobmaster/dm/metadata" dmpkg "github.com/pingcap/tiflow/engine/pkg/dm" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "go.uber.org/zap" ) func TestUnitHolder(t *testing.T) { diff --git a/engine/executor/dm/worker.go b/engine/executor/dm/worker.go index 7ad2d5b0901..c821f4e8559 100644 --- a/engine/executor/dm/worker.go +++ b/engine/executor/dm/worker.go @@ -22,10 +22,6 @@ import ( "github.com/BurntSushi/toml" "github.com/pingcap/errors" "github.com/pingcap/log" - "go.uber.org/zap" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - dmconfig "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/backoff" @@ -44,6 +40,9 @@ import ( "github.com/pingcap/tiflow/engine/pkg/externalresource/broker" "github.com/pingcap/tiflow/engine/pkg/p2p" derror "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // RegisterWorker is used to register dm task to global registry diff --git a/engine/executor/dm/worker_test.go b/engine/executor/dm/worker_test.go index 825ac72b6d7..b25360254e5 100644 --- a/engine/executor/dm/worker_test.go +++ b/engine/executor/dm/worker_test.go @@ -21,9 +21,6 @@ import ( "time" "github.com/BurntSushi/toml" - "github.com/stretchr/testify/require" - "go.uber.org/dig" - dmconfig "github.com/pingcap/tiflow/dm/config" dmmaster "github.com/pingcap/tiflow/dm/master" "github.com/pingcap/tiflow/dm/pb" @@ -41,6 +38,8 @@ import ( pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" cerrors "github.com/pingcap/tiflow/pkg/errors" + "github.com/stretchr/testify/require" + "go.uber.org/dig" ) var jobTemplatePath = "../../jobmaster/dm/config/job_template.yaml" diff --git a/engine/executor/openapi.go b/engine/executor/openapi.go index 986742f6b10..27eb8e29a39 100644 --- a/engine/executor/openapi.go +++ b/engine/executor/openapi.go @@ -20,7 +20,6 @@ import ( "sync" "github.com/gin-gonic/gin" - engineModel "github.com/pingcap/tiflow/engine/model" ) diff --git a/engine/executor/openapi_test.go b/engine/executor/openapi_test.go index d1ca47e9780..5ebc11dfa34 100644 --- a/engine/executor/openapi_test.go +++ b/engine/executor/openapi_test.go @@ -22,9 +22,8 @@ import ( "time" "github.com/gin-gonic/gin" - "github.com/stretchr/testify/require" - engineModel "github.com/pingcap/tiflow/engine/model" + "github.com/stretchr/testify/require" ) func TestJobAPIServer(t *testing.T) { diff --git a/engine/executor/worker/ctx_test.go b/engine/executor/worker/ctx_test.go index 4c4ebf2c6e1..b41f9a7eab2 100644 --- a/engine/executor/worker/ctx_test.go +++ b/engine/executor/worker/ctx_test.go @@ -18,10 +18,9 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/engine/executor/worker/internal" "github.com/pingcap/tiflow/engine/pkg/clock" + "github.com/stretchr/testify/require" ) func TestToRuntimeCtxFromDerivedStdCtx(t *testing.T) { diff --git a/engine/executor/worker/internal/runnables.go b/engine/executor/worker/internal/runnables.go index 79ea2a4f6f3..723103c6dc1 100644 --- a/engine/executor/worker/internal/runnables.go +++ b/engine/executor/worker/internal/runnables.go @@ -17,11 +17,10 @@ import ( "context" "github.com/pingcap/log" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/clock" + "go.uber.org/atomic" + "go.uber.org/zap" ) // Workloader defines an interface to get Workload diff --git a/engine/executor/worker/task_committer.go b/engine/executor/worker/task_committer.go index 5e5cf50a825..21ac6976c60 100644 --- a/engine/executor/worker/task_committer.go +++ b/engine/executor/worker/task_committer.go @@ -18,11 +18,10 @@ import ( "time" "github.com/pingcap/log" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/executor/worker/internal" "github.com/pingcap/tiflow/engine/pkg/clock" + "go.uber.org/atomic" + "go.uber.org/zap" ) const runTTLCheckerInterval = 1 * time.Second diff --git a/engine/executor/worker/task_committer_test.go b/engine/executor/worker/task_committer_test.go index 82b6662eedf..9403116d360 100644 --- a/engine/executor/worker/task_committer_test.go +++ b/engine/executor/worker/task_committer_test.go @@ -17,13 +17,12 @@ import ( "testing" "time" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/engine/executor/worker/internal" "github.com/pingcap/tiflow/engine/framework/taskutil" "github.com/pingcap/tiflow/engine/pkg/clock" "github.com/pingcap/tiflow/pkg/errors" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" ) type mockWrappedTaskAdder struct { diff --git a/engine/executor/worker/task_runner.go b/engine/executor/worker/task_runner.go index 0ad18ac7b92..7cad8346071 100644 --- a/engine/executor/worker/task_runner.go +++ b/engine/executor/worker/task_runner.go @@ -18,15 +18,14 @@ import ( "sync" "github.com/pingcap/errors" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/log" "github.com/pingcap/tiflow/engine/executor/worker/internal" "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/clock" "github.com/pingcap/tiflow/engine/pkg/notifier" cerrors "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/atomic" + "go.uber.org/zap" ) // Re-export types for public use diff --git a/engine/executor/worker/task_runner_test.go b/engine/executor/worker/task_runner_test.go index 781a1b11525..e2f2194d7be 100644 --- a/engine/executor/worker/task_runner_test.go +++ b/engine/executor/worker/task_runner_test.go @@ -20,11 +20,10 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" - "github.com/pingcap/tiflow/engine/framework/taskutil" "github.com/pingcap/tiflow/engine/pkg/clock" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" ) const ( diff --git a/engine/executor/worker/test_util.go b/engine/executor/worker/test_util.go index 345abd5ea39..2b1da7f21ee 100644 --- a/engine/executor/worker/test_util.go +++ b/engine/executor/worker/test_util.go @@ -20,10 +20,9 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "go.uber.org/atomic" - "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/clock" + "go.uber.org/atomic" ) type dummyWorker struct { diff --git a/engine/framework/base_jobmaster.go b/engine/framework/base_jobmaster.go index c0a1d3a39a1..466814b4b5c 100644 --- a/engine/framework/base_jobmaster.go +++ b/engine/framework/base_jobmaster.go @@ -21,8 +21,6 @@ import ( "github.com/gin-gonic/gin" "github.com/pingcap/errors" "github.com/pingcap/log" - "go.uber.org/zap" - runtime "github.com/pingcap/tiflow/engine/executor/worker" "github.com/pingcap/tiflow/engine/framework/internal/eventloop" frameModel "github.com/pingcap/tiflow/engine/framework/model" @@ -35,6 +33,7 @@ import ( "github.com/pingcap/tiflow/engine/pkg/promutil" derror "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/logutil" + "go.uber.org/zap" ) // BaseJobMaster defines an interface that can work as a job master, it embeds diff --git a/engine/framework/base_jobmaster_test.go b/engine/framework/base_jobmaster_test.go index ec1592e9f14..2a2c9ab3d57 100644 --- a/engine/framework/base_jobmaster_test.go +++ b/engine/framework/base_jobmaster_test.go @@ -24,9 +24,6 @@ import ( "github.com/gin-gonic/gin" "github.com/golang/mock/gomock" "github.com/pingcap/errors" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/client" @@ -37,6 +34,8 @@ import ( ormModel "github.com/pingcap/tiflow/engine/pkg/orm/model" "github.com/pingcap/tiflow/engine/pkg/p2p" "github.com/pingcap/tiflow/engine/pkg/tenant" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" ) const ( diff --git a/engine/framework/common.go b/engine/framework/common.go index ead7bdb7af3..fd93d8acbd6 100644 --- a/engine/framework/common.go +++ b/engine/framework/common.go @@ -14,12 +14,11 @@ package framework import ( - "go.uber.org/zap" - "github.com/pingcap/log" "github.com/pingcap/tiflow/engine/framework/internal/master" frameModel "github.com/pingcap/tiflow/engine/framework/model" engineModel "github.com/pingcap/tiflow/engine/model" + "go.uber.org/zap" ) type ( diff --git a/engine/framework/fake/fake_master.go b/engine/framework/fake/fake_master.go index fe1ea279262..c444c55c1ce 100644 --- a/engine/framework/fake/fake_master.go +++ b/engine/framework/fake/fake_master.go @@ -23,10 +23,6 @@ import ( "github.com/gin-gonic/gin" "github.com/pingcap/errors" - "go.uber.org/atomic" - "go.uber.org/zap" - "golang.org/x/time/rate" - "github.com/pingcap/log" "github.com/pingcap/tiflow/engine/executor/worker" "github.com/pingcap/tiflow/engine/framework" @@ -36,6 +32,9 @@ import ( dcontext "github.com/pingcap/tiflow/engine/pkg/context" "github.com/pingcap/tiflow/engine/pkg/p2p" cerrors "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/atomic" + "go.uber.org/zap" + "golang.org/x/time/rate" ) /* diff --git a/engine/framework/fake/fake_worker.go b/engine/framework/fake/fake_worker.go index b2ef9b94dc0..dc5532fdccc 100644 --- a/engine/framework/fake/fake_worker.go +++ b/engine/framework/fake/fake_worker.go @@ -23,18 +23,17 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "golang.org/x/time/rate" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/engine/framework" frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/model" dcontext "github.com/pingcap/tiflow/engine/pkg/context" "github.com/pingcap/tiflow/engine/pkg/p2p" cerrors "github.com/pingcap/tiflow/pkg/errors" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "golang.org/x/time/rate" + "google.golang.org/grpc" ) var _ framework.Worker = (*dummyWorker)(nil) diff --git a/engine/framework/internal/errors/fail_fast_test.go b/engine/framework/internal/errors/fail_fast_test.go index a8d59fd870f..6e4664c7668 100644 --- a/engine/framework/internal/errors/fail_fast_test.go +++ b/engine/framework/internal/errors/fail_fast_test.go @@ -16,9 +16,8 @@ import ( "errors" "testing" - "github.com/stretchr/testify/require" - derrors "github.com/pingcap/tiflow/pkg/errors" + "github.com/stretchr/testify/require" ) func TestFailFastWrap(t *testing.T) { diff --git a/engine/framework/internal/eventloop/runner.go b/engine/framework/internal/eventloop/runner.go index 57cfc057ee2..e86fdb91428 100644 --- a/engine/framework/internal/eventloop/runner.go +++ b/engine/framework/internal/eventloop/runner.go @@ -20,13 +20,12 @@ import ( "time" "github.com/pingcap/errors" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/log" frameErrors "github.com/pingcap/tiflow/engine/framework/internal/errors" "github.com/pingcap/tiflow/engine/pkg/clock" derrors "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/atomic" + "go.uber.org/zap" ) const ( diff --git a/engine/framework/internal/eventloop/runner_test.go b/engine/framework/internal/eventloop/runner_test.go index 1bd48f4d89e..42991dffcce 100644 --- a/engine/framework/internal/eventloop/runner_test.go +++ b/engine/framework/internal/eventloop/runner_test.go @@ -19,13 +19,12 @@ import ( "testing" "time" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" - "github.com/pingcap/errors" runtime "github.com/pingcap/tiflow/engine/executor/worker" derrors "github.com/pingcap/tiflow/pkg/errors" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" ) type toyTaskStatus = int32 diff --git a/engine/framework/internal/master/mock_handle.go b/engine/framework/internal/master/mock_handle.go index 419a22a31b7..9772c288862 100644 --- a/engine/framework/internal/master/mock_handle.go +++ b/engine/framework/internal/master/mock_handle.go @@ -16,12 +16,11 @@ package master import ( "context" - "go.uber.org/atomic" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/p2p" "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/atomic" ) // MockHandle implements WorkerHandle, it can work as either a RunningHandle or diff --git a/engine/framework/internal/master/worker_entry.go b/engine/framework/internal/master/worker_entry.go index 7c67693b938..c1ffdce905b 100644 --- a/engine/framework/internal/master/worker_entry.go +++ b/engine/framework/internal/master/worker_entry.go @@ -19,11 +19,10 @@ import ( "time" "github.com/pingcap/log" - "go.uber.org/atomic" - "go.uber.org/zap" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/model" + "go.uber.org/atomic" + "go.uber.org/zap" ) // workerEntryState is the state of a worker diff --git a/engine/framework/internal/master/worker_handle.go b/engine/framework/internal/master/worker_handle.go index 6c8a3edba5b..b79891cb3ee 100644 --- a/engine/framework/internal/master/worker_handle.go +++ b/engine/framework/internal/master/worker_handle.go @@ -17,11 +17,10 @@ import ( "context" "github.com/pingcap/log" - "go.uber.org/zap" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/p2p" + "go.uber.org/zap" ) // BaseHandle provides some common api of a worker, no matter it is running or dead. diff --git a/engine/framework/internal/master/worker_manager.go b/engine/framework/internal/master/worker_manager.go index 1808f94da45..192ca45ce53 100644 --- a/engine/framework/internal/master/worker_manager.go +++ b/engine/framework/internal/master/worker_manager.go @@ -20,8 +20,6 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/framework/config" "github.com/pingcap/tiflow/engine/framework/metadata" frameModel "github.com/pingcap/tiflow/engine/framework/model" @@ -32,6 +30,7 @@ import ( pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" derror "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/zap" ) type ( diff --git a/engine/framework/internal/master/worker_manager_test.go b/engine/framework/internal/master/worker_manager_test.go index b8f3158cfcb..a9ef01889f5 100644 --- a/engine/framework/internal/master/worker_manager_test.go +++ b/engine/framework/internal/master/worker_manager_test.go @@ -21,10 +21,6 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - "golang.org/x/time/rate" - "github.com/pingcap/tiflow/engine/framework/config" "github.com/pingcap/tiflow/engine/framework/metadata" frameModel "github.com/pingcap/tiflow/engine/framework/model" @@ -33,6 +29,9 @@ import ( pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" derror "github.com/pingcap/tiflow/pkg/errors" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "golang.org/x/time/rate" ) type workerManageTestSuite struct { diff --git a/engine/framework/internal/worker/master_client.go b/engine/framework/internal/worker/master_client.go index d6aac55cbbb..528ec4cdd57 100644 --- a/engine/framework/internal/worker/master_client.go +++ b/engine/framework/internal/worker/master_client.go @@ -19,9 +19,6 @@ import ( "time" "github.com/pingcap/errors" - "go.uber.org/atomic" - "go.uber.org/zap" - "github.com/pingcap/log" "github.com/pingcap/tiflow/engine/framework/config" "github.com/pingcap/tiflow/engine/framework/metadata" @@ -29,6 +26,8 @@ import ( "github.com/pingcap/tiflow/engine/pkg/clock" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" + "go.uber.org/atomic" + "go.uber.org/zap" ) const ( diff --git a/engine/framework/internal/worker/master_client_test.go b/engine/framework/internal/worker/master_client_test.go index 82acf20c2bf..784c72e4d8d 100644 --- a/engine/framework/internal/worker/master_client_test.go +++ b/engine/framework/internal/worker/master_client_test.go @@ -21,14 +21,13 @@ import ( "time" "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/engine/framework/config" frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/pkg/clock" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" ormMock "github.com/pingcap/tiflow/engine/pkg/orm/mock" "github.com/pingcap/tiflow/engine/pkg/p2p" + "github.com/stretchr/testify/require" ) type masterClientTestHelper struct { diff --git a/engine/framework/internal/worker/master_info.go b/engine/framework/internal/worker/master_info.go index 3eb60a9434b..093ee5baf54 100644 --- a/engine/framework/internal/worker/master_info.go +++ b/engine/framework/internal/worker/master_info.go @@ -17,10 +17,9 @@ import ( "context" "sync" - "go.uber.org/atomic" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/pkg/p2p" + "go.uber.org/atomic" ) // MasterInfoProvider is an object that can provide the caller diff --git a/engine/framework/master.go b/engine/framework/master.go index c5060243ddc..81286479ff2 100644 --- a/engine/framework/master.go +++ b/engine/framework/master.go @@ -20,16 +20,9 @@ import ( "sync" "time" - "github.com/pingcap/tiflow/pkg/label" - "github.com/BurntSushi/toml" "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/pingcap/tiflow/engine/pkg/client" - "go.uber.org/atomic" - "go.uber.org/dig" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/framework/config" "github.com/pingcap/tiflow/engine/framework/internal/master" frameLog "github.com/pingcap/tiflow/engine/framework/logutil" @@ -37,6 +30,7 @@ import ( frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/framework/statusutil" "github.com/pingcap/tiflow/engine/model" + "github.com/pingcap/tiflow/engine/pkg/client" "github.com/pingcap/tiflow/engine/pkg/clock" dcontext "github.com/pingcap/tiflow/engine/pkg/context" "github.com/pingcap/tiflow/engine/pkg/deps" @@ -50,8 +44,12 @@ import ( "github.com/pingcap/tiflow/engine/pkg/quota" "github.com/pingcap/tiflow/engine/pkg/tenant" derror "github.com/pingcap/tiflow/pkg/errors" + "github.com/pingcap/tiflow/pkg/label" "github.com/pingcap/tiflow/pkg/logutil" "github.com/pingcap/tiflow/pkg/uuid" + "go.uber.org/atomic" + "go.uber.org/dig" + "go.uber.org/zap" ) // Master defines a basic interface that can run in dataflow engine runtime diff --git a/engine/framework/message_router.go b/engine/framework/message_router.go index 17df45441a1..458f86a24e8 100644 --- a/engine/framework/message_router.go +++ b/engine/framework/message_router.go @@ -18,11 +18,10 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/pingcap/tiflow/pkg/workerpool" - "go.uber.org/zap" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/pkg/p2p" + "github.com/pingcap/tiflow/pkg/workerpool" + "go.uber.org/zap" ) const defaultMessageRouterBufferSize = 4 diff --git a/engine/framework/message_router_test.go b/engine/framework/message_router_test.go index 2d31f3eb376..d49ea868bc5 100644 --- a/engine/framework/message_router_test.go +++ b/engine/framework/message_router_test.go @@ -19,11 +19,10 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" - "github.com/pingcap/tiflow/engine/pkg/p2p" "github.com/pingcap/tiflow/pkg/workerpool" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" ) type testMessage struct { diff --git a/engine/framework/metadata/metadata.go b/engine/framework/metadata/metadata.go index bcaaeed4ca1..b75363b0c13 100644 --- a/engine/framework/metadata/metadata.go +++ b/engine/framework/metadata/metadata.go @@ -18,11 +18,10 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "go.uber.org/zap" - frameModel "github.com/pingcap/tiflow/engine/framework/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" ormModel "github.com/pingcap/tiflow/engine/pkg/orm/model" + "go.uber.org/zap" ) // JobManagerUUID defines the global unique id for job manager diff --git a/engine/framework/metadata/metadata_test.go b/engine/framework/metadata/metadata_test.go index a4f7e714ad2..b0fd775fe77 100644 --- a/engine/framework/metadata/metadata_test.go +++ b/engine/framework/metadata/metadata_test.go @@ -17,10 +17,9 @@ import ( "context" "testing" - "github.com/stretchr/testify/require" - frameModel "github.com/pingcap/tiflow/engine/framework/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" + "github.com/stretchr/testify/require" ) // These constants are only used for unit testing. diff --git a/engine/framework/mock_master_impl.go b/engine/framework/mock_master_impl.go index 991ad468224..ad604453af1 100644 --- a/engine/framework/mock_master_impl.go +++ b/engine/framework/mock_master_impl.go @@ -20,14 +20,9 @@ import ( "testing" "github.com/pingcap/log" - "github.com/pingcap/tiflow/engine/pkg/client" - "github.com/stretchr/testify/mock" - "go.uber.org/atomic" - "go.uber.org/dig" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/framework/internal/master" frameModel "github.com/pingcap/tiflow/engine/framework/model" + "github.com/pingcap/tiflow/engine/pkg/client" dcontext "github.com/pingcap/tiflow/engine/pkg/context" "github.com/pingcap/tiflow/engine/pkg/deps" "github.com/pingcap/tiflow/engine/pkg/externalresource/broker" @@ -35,6 +30,10 @@ import ( metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" + "github.com/stretchr/testify/mock" + "go.uber.org/atomic" + "go.uber.org/dig" + "go.uber.org/zap" ) // MockMasterImpl implements a mock MasterImpl diff --git a/engine/framework/mock_master_util.go b/engine/framework/mock_master_util.go index 7e4afa2786a..ffc707a6fd6 100644 --- a/engine/framework/mock_master_util.go +++ b/engine/framework/mock_master_util.go @@ -22,8 +22,6 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/framework/metadata" frameModel "github.com/pingcap/tiflow/engine/framework/model" @@ -40,6 +38,7 @@ import ( "github.com/pingcap/tiflow/engine/pkg/tenant" "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/uuid" + "github.com/stretchr/testify/require" ) // MockBaseMaster returns a mock DefaultBaseMaster diff --git a/engine/framework/mock_worker_impl.go b/engine/framework/mock_worker_impl.go index f422110fe9f..b66de2708fd 100644 --- a/engine/framework/mock_worker_impl.go +++ b/engine/framework/mock_worker_impl.go @@ -17,15 +17,14 @@ import ( "context" "sync" - "github.com/stretchr/testify/mock" - "go.uber.org/atomic" - "go.uber.org/dig" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/pkg/externalresource/broker" metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" + "github.com/stretchr/testify/mock" + "go.uber.org/atomic" + "go.uber.org/dig" ) type mockWorkerImpl struct { diff --git a/engine/framework/mock_worker_util.go b/engine/framework/mock_worker_util.go index 6c511ecbda7..479ee86cde8 100644 --- a/engine/framework/mock_worker_util.go +++ b/engine/framework/mock_worker_util.go @@ -20,8 +20,6 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/framework/statusutil" dcontext "github.com/pingcap/tiflow/engine/pkg/context" @@ -30,6 +28,7 @@ import ( metaMock "github.com/pingcap/tiflow/engine/pkg/meta/mock" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" + "github.com/stretchr/testify/require" ) // BaseWorkerForTesting mocks base worker diff --git a/engine/framework/model/worker.go b/engine/framework/model/worker.go index c887c9d8645..f32c26a8438 100644 --- a/engine/framework/model/worker.go +++ b/engine/framework/model/worker.go @@ -17,7 +17,6 @@ import ( "encoding/json" "github.com/pingcap/errors" - ormModel "github.com/pingcap/tiflow/engine/pkg/orm/model" "github.com/pingcap/tiflow/engine/pkg/tenant" ) diff --git a/engine/framework/registry/factory.go b/engine/framework/registry/factory.go index 9effbaeec38..36f48d36934 100644 --- a/engine/framework/registry/factory.go +++ b/engine/framework/registry/factory.go @@ -19,7 +19,6 @@ import ( "reflect" "github.com/pingcap/errors" - "github.com/pingcap/log" "github.com/pingcap/tiflow/engine/framework" "github.com/pingcap/tiflow/engine/framework/fake" diff --git a/engine/framework/registry/factory_test.go b/engine/framework/registry/factory_test.go index 693069cd5ec..0e95ce6227b 100644 --- a/engine/framework/registry/factory_test.go +++ b/engine/framework/registry/factory_test.go @@ -17,9 +17,6 @@ import ( "context" "testing" - "github.com/stretchr/testify/require" - "go.uber.org/dig" - "github.com/pingcap/tiflow/engine/framework/fake" dcontext "github.com/pingcap/tiflow/engine/pkg/context" "github.com/pingcap/tiflow/engine/pkg/deps" @@ -28,6 +25,8 @@ import ( metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" + "github.com/stretchr/testify/require" + "go.uber.org/dig" ) type paramList struct { diff --git a/engine/framework/registry/registry.go b/engine/framework/registry/registry.go index dbe4b1cda64..0e918b3b8ed 100644 --- a/engine/framework/registry/registry.go +++ b/engine/framework/registry/registry.go @@ -19,13 +19,12 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/pingcap/tiflow/engine/pkg/client" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/framework" frameModel "github.com/pingcap/tiflow/engine/framework/model" + "github.com/pingcap/tiflow/engine/pkg/client" dcontext "github.com/pingcap/tiflow/engine/pkg/context" derror "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/zap" ) // WorkerConfig alias to framework.WorkerConfig diff --git a/engine/framework/registry/registry_test.go b/engine/framework/registry/registry_test.go index f294fdc61e8..0956161b213 100644 --- a/engine/framework/registry/registry_test.go +++ b/engine/framework/registry/registry_test.go @@ -16,14 +16,13 @@ package registry import ( "testing" - "github.com/stretchr/testify/require" - "github.com/pingcap/errors" "github.com/pingcap/tiflow/engine/framework" "github.com/pingcap/tiflow/engine/framework/fake" frameModel "github.com/pingcap/tiflow/engine/framework/model" dcontext "github.com/pingcap/tiflow/engine/pkg/context" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" + "github.com/stretchr/testify/require" ) var fakeWorkerFactory WorkerFactory = NewSimpleWorkerFactory(fake.NewDummyWorker) diff --git a/engine/framework/statusutil/writer.go b/engine/framework/statusutil/writer.go index 8b6c9c80afb..e0433b6ced4 100644 --- a/engine/framework/statusutil/writer.go +++ b/engine/framework/statusutil/writer.go @@ -17,18 +17,16 @@ import ( "context" "time" - "go.uber.org/zap" - "golang.org/x/time/rate" - "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/pingcap/tiflow/engine/framework/internal/worker" frameModel "github.com/pingcap/tiflow/engine/framework/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" derrors "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/retry" + "go.uber.org/zap" + "golang.org/x/time/rate" ) // Writer is used to persist WorkerStatus changes and send notifications diff --git a/engine/framework/statusutil/writer_test.go b/engine/framework/statusutil/writer_test.go index b85fc0452a8..920c1f897ee 100644 --- a/engine/framework/statusutil/writer_test.go +++ b/engine/framework/statusutil/writer_test.go @@ -17,13 +17,12 @@ import ( "context" "testing" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/engine/framework/internal/worker" frameModel "github.com/pingcap/tiflow/engine/framework/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" "github.com/pingcap/tiflow/pkg/errors" + "github.com/stretchr/testify/require" ) type writerTestSuite struct { diff --git a/engine/framework/worker.go b/engine/framework/worker.go index 8d2505749b1..74e2eb21404 100644 --- a/engine/framework/worker.go +++ b/engine/framework/worker.go @@ -20,9 +20,6 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "go.uber.org/dig" - "go.uber.org/zap" - runtime "github.com/pingcap/tiflow/engine/executor/worker" "github.com/pingcap/tiflow/engine/framework/config" frameErrors "github.com/pingcap/tiflow/engine/framework/internal/errors" @@ -46,6 +43,8 @@ import ( derror "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/logutil" "github.com/pingcap/tiflow/pkg/workerpool" + "go.uber.org/dig" + "go.uber.org/zap" ) // Worker defines an interface that provides all methods that will be used in diff --git a/engine/framework/worker_test.go b/engine/framework/worker_test.go index 7f12356ea9c..9c041c32c57 100644 --- a/engine/framework/worker_test.go +++ b/engine/framework/worker_test.go @@ -21,16 +21,15 @@ import ( "time" "github.com/pingcap/errors" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" - runtime "github.com/pingcap/tiflow/engine/executor/worker" "github.com/pingcap/tiflow/engine/framework/config" frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/framework/statusutil" "github.com/pingcap/tiflow/engine/pkg/clock" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" ) var _ Worker = (*DefaultBaseWorker)(nil) // _ runtime.Runnable = (Worker)(nil) diff --git a/engine/jobmaster/cvsjob/cvs_job_master.go b/engine/jobmaster/cvsjob/cvs_job_master.go index 8e88d4e0ca1..9b63d55b372 100644 --- a/engine/jobmaster/cvsjob/cvs_job_master.go +++ b/engine/jobmaster/cvsjob/cvs_job_master.go @@ -22,10 +22,6 @@ import ( "unsafe" "github.com/gin-gonic/gin" - "go.uber.org/atomic" - "go.uber.org/zap" - "golang.org/x/time/rate" - "github.com/pingcap/log" cvsTask "github.com/pingcap/tiflow/engine/executor/cvs" "github.com/pingcap/tiflow/engine/executor/worker" @@ -37,6 +33,9 @@ import ( dcontext "github.com/pingcap/tiflow/engine/pkg/context" "github.com/pingcap/tiflow/engine/pkg/p2p" derrors "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/atomic" + "go.uber.org/zap" + "golang.org/x/time/rate" ) // Config records all configurations of cvs job diff --git a/engine/jobmaster/dm/checkpoint/agent_test.go b/engine/jobmaster/dm/checkpoint/agent_test.go index 54a49ae6884..d64fc94e64e 100644 --- a/engine/jobmaster/dm/checkpoint/agent_test.go +++ b/engine/jobmaster/dm/checkpoint/agent_test.go @@ -25,11 +25,10 @@ import ( "github.com/pingcap/log" dmconfig "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/pkg/conn" - "github.com/stretchr/testify/require" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/jobmaster/dm/config" "github.com/pingcap/tiflow/engine/jobmaster/dm/metadata" + "github.com/stretchr/testify/require" ) func TestTableName(t *testing.T) { diff --git a/engine/jobmaster/dm/dm_jobmaster.go b/engine/jobmaster/dm/dm_jobmaster.go index ae7cafbef4e..b6cfc46b363 100644 --- a/engine/jobmaster/dm/dm_jobmaster.go +++ b/engine/jobmaster/dm/dm_jobmaster.go @@ -22,8 +22,6 @@ import ( "github.com/coreos/go-semver/semver" "github.com/gin-gonic/gin" "github.com/pingcap/errors" - "go.uber.org/zap" - "github.com/pingcap/log" "github.com/pingcap/tiflow/dm/checker" dmconfig "github.com/pingcap/tiflow/dm/config" @@ -41,6 +39,7 @@ import ( dcontext "github.com/pingcap/tiflow/engine/pkg/context" dmpkg "github.com/pingcap/tiflow/engine/pkg/dm" "github.com/pingcap/tiflow/engine/pkg/p2p" + "go.uber.org/zap" ) // JobMaster defines job master of dm job diff --git a/engine/jobmaster/dm/dm_jobmaster_test.go b/engine/jobmaster/dm/dm_jobmaster_test.go index fbd01287682..938ebc10e74 100644 --- a/engine/jobmaster/dm/dm_jobmaster_test.go +++ b/engine/jobmaster/dm/dm_jobmaster_test.go @@ -25,20 +25,13 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/coreos/go-semver/semver" "github.com/golang/mock/gomock" - pb "github.com/pingcap/tiflow/engine/enginepb" - "github.com/pingcap/tiflow/engine/pkg/client" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - "go.uber.org/dig" - "go.uber.org/zap" - "github.com/pingcap/log" "github.com/pingcap/tiflow/dm/checker" dmconfig "github.com/pingcap/tiflow/dm/config" "github.com/pingcap/tiflow/dm/master" dmpb "github.com/pingcap/tiflow/dm/pb" "github.com/pingcap/tiflow/dm/pkg/conn" + pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/framework" libMetadata "github.com/pingcap/tiflow/engine/framework/metadata" frameModel "github.com/pingcap/tiflow/engine/framework/model" @@ -48,6 +41,7 @@ import ( "github.com/pingcap/tiflow/engine/jobmaster/dm/metadata" "github.com/pingcap/tiflow/engine/jobmaster/dm/runtime" "github.com/pingcap/tiflow/engine/model" + "github.com/pingcap/tiflow/engine/pkg/client" dcontext "github.com/pingcap/tiflow/engine/pkg/context" "github.com/pingcap/tiflow/engine/pkg/deps" dmpkg "github.com/pingcap/tiflow/engine/pkg/dm" @@ -58,6 +52,11 @@ import ( pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/p2p" "github.com/pingcap/tiflow/pkg/logutil" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "go.uber.org/dig" + "go.uber.org/zap" ) func TestDMJobmasterSuite(t *testing.T) { diff --git a/engine/jobmaster/dm/metadata/cluster_info_test.go b/engine/jobmaster/dm/metadata/cluster_info_test.go index 7fc22eb032a..d97e0c0d31d 100644 --- a/engine/jobmaster/dm/metadata/cluster_info_test.go +++ b/engine/jobmaster/dm/metadata/cluster_info_test.go @@ -18,10 +18,9 @@ import ( "testing" "github.com/coreos/go-semver/semver" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/engine/pkg/adapter" "github.com/pingcap/tiflow/engine/pkg/meta/mock" + "github.com/stretchr/testify/require" ) func TestInfoStore(t *testing.T) { diff --git a/engine/jobmaster/dm/metadata/job.go b/engine/jobmaster/dm/metadata/job.go index 72e0890d75e..d2f20cfe5a2 100644 --- a/engine/jobmaster/dm/metadata/job.go +++ b/engine/jobmaster/dm/metadata/job.go @@ -20,12 +20,11 @@ import ( "sync" "github.com/pingcap/errors" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/jobmaster/dm/bootstrap" "github.com/pingcap/tiflow/engine/jobmaster/dm/config" "github.com/pingcap/tiflow/engine/pkg/adapter" metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" + "go.uber.org/zap" ) // TaskStage represents internal stage of a task diff --git a/engine/jobmaster/dm/metadata/job_test.go b/engine/jobmaster/dm/metadata/job_test.go index 9421c44b4ca..f57c5ae4f71 100644 --- a/engine/jobmaster/dm/metadata/job_test.go +++ b/engine/jobmaster/dm/metadata/job_test.go @@ -21,11 +21,10 @@ import ( "github.com/pingcap/log" dmconfig "github.com/pingcap/tiflow/dm/config" dmmaster "github.com/pingcap/tiflow/dm/master" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/engine/jobmaster/dm/config" "github.com/pingcap/tiflow/engine/pkg/adapter" "github.com/pingcap/tiflow/engine/pkg/meta/mock" + "github.com/stretchr/testify/require" ) const ( diff --git a/engine/jobmaster/dm/metadata/state.go b/engine/jobmaster/dm/metadata/state.go index d4f49283563..9f55c42cb47 100644 --- a/engine/jobmaster/dm/metadata/state.go +++ b/engine/jobmaster/dm/metadata/state.go @@ -21,7 +21,6 @@ import ( "github.com/BurntSushi/toml" "github.com/pingcap/errors" - metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" ) diff --git a/engine/jobmaster/dm/metadata/state_test.go b/engine/jobmaster/dm/metadata/state_test.go index 1f5c9f94b7d..a0b526a02da 100644 --- a/engine/jobmaster/dm/metadata/state_test.go +++ b/engine/jobmaster/dm/metadata/state_test.go @@ -19,9 +19,8 @@ import ( "testing" "github.com/BurntSushi/toml" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/engine/pkg/meta/mock" + "github.com/stretchr/testify/require" ) type DummyState struct { diff --git a/engine/jobmaster/dm/runtime/task_status_test.go b/engine/jobmaster/dm/runtime/task_status_test.go index b0709380e38..4de4b1dc74e 100644 --- a/engine/jobmaster/dm/runtime/task_status_test.go +++ b/engine/jobmaster/dm/runtime/task_status_test.go @@ -16,10 +16,9 @@ package runtime import ( "testing" - "github.com/stretchr/testify/require" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/jobmaster/dm/metadata" + "github.com/stretchr/testify/require" ) func TestTaskStatus(t *testing.T) { diff --git a/engine/jobmaster/dm/runtime/worker_status_test.go b/engine/jobmaster/dm/runtime/worker_status_test.go index 9db03e32e12..d35961c665c 100644 --- a/engine/jobmaster/dm/runtime/worker_status_test.go +++ b/engine/jobmaster/dm/runtime/worker_status_test.go @@ -18,9 +18,8 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - frameModel "github.com/pingcap/tiflow/engine/framework/model" + "github.com/stretchr/testify/require" ) func TestWorkerStatus(t *testing.T) { diff --git a/engine/jobmaster/dm/task_manager.go b/engine/jobmaster/dm/task_manager.go index 8c55a4645db..b25cbcbf050 100644 --- a/engine/jobmaster/dm/task_manager.go +++ b/engine/jobmaster/dm/task_manager.go @@ -20,14 +20,13 @@ import ( "github.com/pingcap/errors" dmconfig "github.com/pingcap/tiflow/dm/config" - dmpkg "github.com/pingcap/tiflow/engine/pkg/dm" - "go.uber.org/zap" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/jobmaster/dm/config" "github.com/pingcap/tiflow/engine/jobmaster/dm/metadata" "github.com/pingcap/tiflow/engine/jobmaster/dm/runtime" "github.com/pingcap/tiflow/engine/jobmaster/dm/ticker" + dmpkg "github.com/pingcap/tiflow/engine/pkg/dm" + "go.uber.org/zap" ) var ( diff --git a/engine/jobmaster/dm/task_manager_test.go b/engine/jobmaster/dm/task_manager_test.go index ebbc0ad5149..eb8a8902127 100644 --- a/engine/jobmaster/dm/task_manager_test.go +++ b/engine/jobmaster/dm/task_manager_test.go @@ -20,10 +20,6 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" - dmconfig "github.com/pingcap/tiflow/dm/config" frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/jobmaster/dm/config" @@ -31,6 +27,9 @@ import ( "github.com/pingcap/tiflow/engine/jobmaster/dm/runtime" dmpkg "github.com/pingcap/tiflow/engine/pkg/dm" kvmock "github.com/pingcap/tiflow/engine/pkg/meta/mock" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" ) const ( diff --git a/engine/jobmaster/example/master_impl.go b/engine/jobmaster/example/master_impl.go index a4434466df4..157b9976c5b 100644 --- a/engine/jobmaster/example/master_impl.go +++ b/engine/jobmaster/example/master_impl.go @@ -18,11 +18,10 @@ import ( "sync" "github.com/pingcap/log" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/framework" frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/pkg/p2p" + "go.uber.org/zap" ) const ( diff --git a/engine/jobmaster/example/worker_impl.go b/engine/jobmaster/example/worker_impl.go index 3a2e12f6d1f..ebe97e1bce6 100644 --- a/engine/jobmaster/example/worker_impl.go +++ b/engine/jobmaster/example/worker_impl.go @@ -20,11 +20,10 @@ import ( "time" "github.com/pingcap/log" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/framework" frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/pkg/p2p" + "go.uber.org/zap" ) var _ framework.Worker = &exampleWorker{} diff --git a/engine/pkg/client/discovery_client.go b/engine/pkg/client/discovery_client.go index 1ff231afa75..71e9e23c3a4 100644 --- a/engine/pkg/client/discovery_client.go +++ b/engine/pkg/client/discovery_client.go @@ -16,12 +16,11 @@ package client import ( "context" - "github.com/pingcap/tiflow/pkg/retry" - "github.com/pingcap/errors" "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/client/internal" + "github.com/pingcap/tiflow/pkg/retry" ) // DiscoveryClient is a client to the Discovery service on the server master. diff --git a/engine/pkg/client/executor_service_client_test.go b/engine/pkg/client/executor_service_client_test.go index 90a247f034d..3322c17a107 100644 --- a/engine/pkg/client/executor_service_client_test.go +++ b/engine/pkg/client/executor_service_client_test.go @@ -19,14 +19,13 @@ import ( "github.com/golang/mock/gomock" "github.com/pingcap/errors" + "github.com/pingcap/tiflow/engine/enginepb" + pbMock "github.com/pingcap/tiflow/engine/enginepb/mock" "github.com/stretchr/testify/require" "go.uber.org/atomic" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - "github.com/pingcap/tiflow/engine/enginepb" - pbMock "github.com/pingcap/tiflow/engine/enginepb/mock" ) func TestDispatchTaskNormal(t *testing.T) { diff --git a/engine/pkg/cmd/cli/cli.go b/engine/pkg/cmd/cli/cli.go index 2b1c76989eb..fe98e8dd65f 100644 --- a/engine/pkg/cmd/cli/cli.go +++ b/engine/pkg/cmd/cli/cli.go @@ -20,10 +20,9 @@ import ( "github.com/chzyer/readline" "github.com/mattn/go-shellwords" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/engine/pkg/cmd/util" ticdcutil "github.com/pingcap/tiflow/pkg/cmd/util" + "github.com/spf13/cobra" ) // options defines flags for the `cli` command. diff --git a/engine/pkg/cmd/cli/cli_job.go b/engine/pkg/cmd/cli/cli_job.go index 2eb799d7652..bdd5d078cbf 100644 --- a/engine/pkg/cmd/cli/cli_job.go +++ b/engine/pkg/cmd/cli/cli_job.go @@ -20,11 +20,10 @@ import ( perrors "github.com/pingcap/errors" "github.com/pingcap/log" "github.com/pingcap/tiflow/engine/enginepb" + "github.com/pingcap/tiflow/engine/pkg/tenant" "github.com/spf13/cobra" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - - "github.com/pingcap/tiflow/engine/pkg/tenant" ) // defaultMasterAddr is the default master address. diff --git a/engine/pkg/cmd/cmd.go b/engine/pkg/cmd/cmd.go index cf5f2629e7f..82fe6d3e429 100644 --- a/engine/pkg/cmd/cmd.go +++ b/engine/pkg/cmd/cmd.go @@ -16,12 +16,11 @@ package cmd import ( "os" - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/engine/pkg/cmd/cli" "github.com/pingcap/tiflow/engine/pkg/cmd/executor" "github.com/pingcap/tiflow/engine/pkg/cmd/master" "github.com/pingcap/tiflow/engine/pkg/cmd/version" + "github.com/spf13/cobra" ) // NewCmd creates the root command. diff --git a/engine/pkg/cmd/executor/executor.go b/engine/pkg/cmd/executor/executor.go index 82fec98771f..e9490706b3d 100644 --- a/engine/pkg/cmd/executor/executor.go +++ b/engine/pkg/cmd/executor/executor.go @@ -20,16 +20,15 @@ import ( "github.com/gin-gonic/gin" "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/spf13/cobra" - "github.com/spf13/pflag" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/executor" "github.com/pingcap/tiflow/engine/pkg/cmd/util" cmdconetxt "github.com/pingcap/tiflow/pkg/cmd/context" ticdcutil "github.com/pingcap/tiflow/pkg/cmd/util" "github.com/pingcap/tiflow/pkg/logutil" "github.com/pingcap/tiflow/pkg/version" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "go.uber.org/zap" ) // options defines flags for the `server` command. diff --git a/engine/pkg/cmd/master/master.go b/engine/pkg/cmd/master/master.go index d3256a9950f..cfbdeaca1d2 100644 --- a/engine/pkg/cmd/master/master.go +++ b/engine/pkg/cmd/master/master.go @@ -20,16 +20,15 @@ import ( "github.com/gin-gonic/gin" "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/spf13/cobra" - "github.com/spf13/pflag" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/pkg/cmd/util" "github.com/pingcap/tiflow/engine/servermaster" cmdconetxt "github.com/pingcap/tiflow/pkg/cmd/context" ticdcutil "github.com/pingcap/tiflow/pkg/cmd/util" "github.com/pingcap/tiflow/pkg/logutil" "github.com/pingcap/tiflow/pkg/version" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "go.uber.org/zap" ) // options defines flags for the `server` command. diff --git a/engine/pkg/cmd/util/helper.go b/engine/pkg/cmd/util/helper.go index 0cec29cae70..884980799c2 100644 --- a/engine/pkg/cmd/util/helper.go +++ b/engine/pkg/cmd/util/helper.go @@ -20,10 +20,9 @@ import ( "syscall" "github.com/pingcap/log" + cmdconetxt "github.com/pingcap/tiflow/pkg/cmd/context" "github.com/spf13/cobra" "go.uber.org/zap" - - cmdconetxt "github.com/pingcap/tiflow/pkg/cmd/context" ) // InitCmd initializes the default context and returns its cancel function. diff --git a/engine/pkg/cmd/version/version.go b/engine/pkg/cmd/version/version.go index 5819c054cc0..d17dcbfa3b3 100644 --- a/engine/pkg/cmd/version/version.go +++ b/engine/pkg/cmd/version/version.go @@ -14,9 +14,8 @@ package version import ( - "github.com/spf13/cobra" - "github.com/pingcap/tiflow/pkg/version" + "github.com/spf13/cobra" ) // NewCmdVersion creates the `version` command. diff --git a/engine/pkg/dataset/dataset_test.go b/engine/pkg/dataset/dataset_test.go index 1f11ea32a23..5ad2e2691ae 100644 --- a/engine/pkg/dataset/dataset_test.go +++ b/engine/pkg/dataset/dataset_test.go @@ -18,10 +18,9 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/engine/pkg/adapter" "github.com/pingcap/tiflow/engine/pkg/meta/mock" + "github.com/stretchr/testify/require" ) type record struct { diff --git a/engine/pkg/deps/deps_test.go b/engine/pkg/deps/deps_test.go index 994654fcc39..127bfbdfed8 100644 --- a/engine/pkg/deps/deps_test.go +++ b/engine/pkg/deps/deps_test.go @@ -16,9 +16,8 @@ package deps import ( "testing" - "go.uber.org/dig" - "github.com/stretchr/testify/require" + "go.uber.org/dig" ) type a struct { diff --git a/engine/pkg/dm/message_agent_test.go b/engine/pkg/dm/message_agent_test.go index 0c30e484632..ad27cc09fd7 100644 --- a/engine/pkg/dm/message_agent_test.go +++ b/engine/pkg/dm/message_agent_test.go @@ -22,12 +22,11 @@ import ( "testing" "time" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "github.com/pingcap/log" "github.com/pingcap/tiflow/engine/framework" "github.com/pingcap/tiflow/engine/pkg/p2p" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" ) func TestAllocID(t *testing.T) { diff --git a/engine/pkg/externalresource/broker/storage_handle_test.go b/engine/pkg/externalresource/broker/storage_handle_test.go index 07cfd0353ab..0eb4163cb9d 100644 --- a/engine/pkg/externalresource/broker/storage_handle_test.go +++ b/engine/pkg/externalresource/broker/storage_handle_test.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/tiflow/engine/pkg/externalresource/internal/local" "github.com/pingcap/tiflow/engine/pkg/externalresource/manager" "github.com/pingcap/tiflow/engine/pkg/externalresource/model" - resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" "github.com/pingcap/tiflow/engine/pkg/tenant" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -33,7 +32,7 @@ func newResourceIdentForTesting(executor, workerID, resourceName string) interna Name: resourceName, ResourceScope: internal.ResourceScope{ ProjectInfo: tenant.NewProjectInfo("fakeTenant", "fakeProject"), - Executor: resModel.ExecutorID(executor), + Executor: model.ExecutorID(executor), WorkerID: workerID, }, } @@ -45,7 +44,7 @@ func TestStorageHandlePersistAndDiscard(t *testing.T) { executor := model.ExecutorID("executor-1") ident := newResourceIdentForTesting(string(executor), "worker-1", "test-resource") - fm := local.NewLocalFileManager(executor, resModel.LocalFileConfig{BaseDir: dir}) + fm := local.NewLocalFileManager(executor, model.LocalFileConfig{BaseDir: dir}) cli := manager.NewMockClient() ctx := context.Background() @@ -109,7 +108,7 @@ func TestStorageHandlePersistAndDiscard(t *testing.T) { func TestStorageHandleDiscardTemporaryResource(t *testing.T) { t.Parallel() dir := t.TempDir() - fm := local.NewLocalFileManager("", resModel.LocalFileConfig{BaseDir: dir}) + fm := local.NewLocalFileManager("", model.LocalFileConfig{BaseDir: dir}) cli := manager.NewMockClient() ctx := context.Background() diff --git a/engine/pkg/externalresource/integration_test/gc_test.go b/engine/pkg/externalresource/integration_test/gc_test.go index 4b60221927b..01623202827 100644 --- a/engine/pkg/externalresource/integration_test/gc_test.go +++ b/engine/pkg/externalresource/integration_test/gc_test.go @@ -19,15 +19,14 @@ import ( "time" "github.com/pingcap/log" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/externalresource/internal/local" resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/engine/pkg/tenant" + "github.com/stretchr/testify/require" + "go.uber.org/zap" ) func TestLocalFileTriggeredByJobRemoval(t *testing.T) { diff --git a/engine/pkg/externalresource/internal/local/file_manager_test.go b/engine/pkg/externalresource/internal/local/file_manager_test.go index 7d309493678..1ed3b348ef9 100644 --- a/engine/pkg/externalresource/internal/local/file_manager_test.go +++ b/engine/pkg/externalresource/internal/local/file_manager_test.go @@ -20,11 +20,10 @@ import ( "path/filepath" "testing" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/engine/pkg/externalresource/internal" resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" "github.com/pingcap/tiflow/engine/pkg/tenant" + "github.com/stretchr/testify/require" ) func newResourceIdentForTesting(executor, workerID, resourceName string) internal.ResourceIdent { diff --git a/engine/pkg/externalresource/internal/local/file_utils.go b/engine/pkg/externalresource/internal/local/file_utils.go index 013a919e5bf..f71be01c496 100644 --- a/engine/pkg/externalresource/internal/local/file_utils.go +++ b/engine/pkg/externalresource/internal/local/file_utils.go @@ -19,13 +19,12 @@ import ( "path/filepath" "testing" - "github.com/stretchr/testify/require" - "github.com/pingcap/errors" brStorage "github.com/pingcap/tidb/br/pkg/storage" frameModel "github.com/pingcap/tiflow/engine/framework/model" resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" derrors "github.com/pingcap/tiflow/pkg/errors" + "github.com/stretchr/testify/require" ) func newBrStorageForLocalFile(filePath string) (brStorage.ExternalStorage, error) { diff --git a/engine/pkg/externalresource/manager/gc_coordinator.go b/engine/pkg/externalresource/manager/gc_coordinator.go index 02562ceaf57..f000a9bbf3c 100644 --- a/engine/pkg/externalresource/manager/gc_coordinator.go +++ b/engine/pkg/externalresource/manager/gc_coordinator.go @@ -20,16 +20,14 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "go.uber.org/ratelimit" - "go.uber.org/zap" - frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/pingcap/tiflow/engine/model" - engineModel "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/externalresource/internal/s3" resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" "github.com/pingcap/tiflow/engine/pkg/notifier" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" + "go.uber.org/ratelimit" + "go.uber.org/zap" ) var _ GCCoordinator = &DefaultGCCoordinator{} @@ -175,7 +173,7 @@ func (c *DefaultGCCoordinator) gcByStatusSnapshots( executorSet[id] = struct{}{} } - toGCJobSet := make(map[engineModel.JobID]struct{}) + toGCJobSet := make(map[model.JobID]struct{}) toGCExecutorSet := make(map[model.ExecutorID]struct{}) for _, resMeta := range resources { if _, exists := jobSnapshot[resMeta.Job]; !exists { @@ -198,7 +196,7 @@ func (c *DefaultGCCoordinator) gcByStatusSnapshots( } } - toGCJobs := make([]engineModel.JobID, 0, len(toGCJobSet)) + toGCJobs := make([]model.JobID, 0, len(toGCJobSet)) for jobID := range toGCJobSet { toGCJobs = append(toGCJobs, jobID) } diff --git a/engine/pkg/externalresource/manager/gc_coordinator_test.go b/engine/pkg/externalresource/manager/gc_coordinator_test.go index dcee75defae..8a623333ccd 100644 --- a/engine/pkg/externalresource/manager/gc_coordinator_test.go +++ b/engine/pkg/externalresource/manager/gc_coordinator_test.go @@ -19,13 +19,12 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - frameModel "github.com/pingcap/tiflow/engine/framework/model" + "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/externalresource/internal/s3" - "github.com/pingcap/tiflow/engine/pkg/externalresource/model" resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" + "github.com/stretchr/testify/require" ) type gcTestHelper struct { diff --git a/engine/pkg/externalresource/manager/gc_runner.go b/engine/pkg/externalresource/manager/gc_runner.go index 7a5562dec95..d4467356484 100644 --- a/engine/pkg/externalresource/manager/gc_runner.go +++ b/engine/pkg/externalresource/manager/gc_runner.go @@ -19,11 +19,6 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" - "go.uber.org/ratelimit" - "go.uber.org/zap" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/client" "github.com/pingcap/tiflow/engine/pkg/clock" @@ -33,6 +28,10 @@ import ( resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" "github.com/pingcap/tiflow/pkg/retry" + "go.uber.org/ratelimit" + "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) var ( diff --git a/engine/pkg/externalresource/manager/gc_runner_test.go b/engine/pkg/externalresource/manager/gc_runner_test.go index a102e8b7ba8..6f8b3721709 100644 --- a/engine/pkg/externalresource/manager/gc_runner_test.go +++ b/engine/pkg/externalresource/manager/gc_runner_test.go @@ -22,13 +22,12 @@ import ( "time" "github.com/pingcap/errors" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/clock" "github.com/pingcap/tiflow/engine/pkg/externalresource/internal/s3" resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" + "github.com/stretchr/testify/require" ) type gcRunnerTestHelper struct { diff --git a/engine/pkg/externalresource/manager/service.go b/engine/pkg/externalresource/manager/service.go index d2b2bb56de0..2d5351e56ed 100644 --- a/engine/pkg/externalresource/manager/service.go +++ b/engine/pkg/externalresource/manager/service.go @@ -17,10 +17,6 @@ import ( "context" "github.com/pingcap/log" - "go.uber.org/zap" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/externalresource/internal" @@ -29,6 +25,9 @@ import ( "github.com/pingcap/tiflow/engine/pkg/rpcutil" "github.com/pingcap/tiflow/engine/pkg/tenant" "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) var _ pb.ResourceManagerServer = (*Service)(nil) diff --git a/engine/pkg/meta/internal/etcdkv/connection.go b/engine/pkg/meta/internal/etcdkv/connection.go index 10068e04be9..0daf9f7510d 100644 --- a/engine/pkg/meta/internal/etcdkv/connection.go +++ b/engine/pkg/meta/internal/etcdkv/connection.go @@ -18,18 +18,17 @@ import ( metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" "github.com/pingcap/tiflow/pkg/errors" - cerrors "github.com/pingcap/tiflow/pkg/errors" clientv3 "go.etcd.io/etcd/client/v3" ) // NewClientConnImpl return a new clientConnImpl func NewClientConnImpl(storeConf *metaModel.StoreConfig) (*clientConnImpl, error) { if storeConf == nil { - return nil, cerrors.ErrMetaParamsInvalid.GenWithStackByArgs("store config is nil") + return nil, errors.ErrMetaParamsInvalid.GenWithStackByArgs("store config is nil") } if storeConf.StoreType != metaModel.StoreTypeEtcd { - return nil, cerrors.ErrMetaParamsInvalid.GenWithStack( + return nil, errors.ErrMetaParamsInvalid.GenWithStack( "etcd conn but get unmatch type:%s", storeConf.StoreType) } @@ -54,7 +53,7 @@ func (cc *clientConnImpl) GetConn() (interface{}, error) { defer cc.rwLock.RUnlock() if cc.cli == nil { - return nil, cerrors.ErrMetaOpFail.GenWithStackByArgs("connection is uninitialized") + return nil, errors.ErrMetaOpFail.GenWithStackByArgs("connection is uninitialized") } return cc.cli, nil diff --git a/engine/pkg/meta/internal/etcdkv/etcd_impl.go b/engine/pkg/meta/internal/etcdkv/etcd_impl.go index 3295942d4f2..570cbae6fd0 100644 --- a/engine/pkg/meta/internal/etcdkv/etcd_impl.go +++ b/engine/pkg/meta/internal/etcdkv/etcd_impl.go @@ -18,10 +18,9 @@ import ( "fmt" "sync" - clientv3 "go.etcd.io/etcd/client/v3" - metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" "github.com/pingcap/tiflow/pkg/errors" + clientv3 "go.etcd.io/etcd/client/v3" ) // Defines fake key/value pair which is used in aliveness check or epoch generation diff --git a/engine/pkg/meta/internal/etcdkv/util.go b/engine/pkg/meta/internal/etcdkv/util.go index 0712c03d2f1..30d16fe2bcf 100644 --- a/engine/pkg/meta/internal/etcdkv/util.go +++ b/engine/pkg/meta/internal/etcdkv/util.go @@ -16,12 +16,11 @@ package etcdkv import ( "strconv" - "go.etcd.io/etcd/api/v3/etcdserverpb" - clientv3 "go.etcd.io/etcd/client/v3" - metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/errorutil" + "go.etcd.io/etcd/api/v3/etcdserverpb" + clientv3 "go.etcd.io/etcd/client/v3" ) func makePutResp(etcdResp *clientv3.PutResponse) *metaModel.PutResponse { diff --git a/engine/pkg/meta/internal/sqlkv/sql_impl.go b/engine/pkg/meta/internal/sqlkv/sql_impl.go index 7643c42e271..4020a0b07da 100644 --- a/engine/pkg/meta/internal/sqlkv/sql_impl.go +++ b/engine/pkg/meta/internal/sqlkv/sql_impl.go @@ -22,15 +22,14 @@ import ( "github.com/VividCortex/mysqlerr" "github.com/go-sql-driver/mysql" "github.com/pingcap/log" - "go.uber.org/zap" - "gorm.io/gorm" - "gorm.io/gorm/clause" - sqlkvModel "github.com/pingcap/tiflow/engine/pkg/meta/internal/sqlkv/model" metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" "github.com/pingcap/tiflow/engine/pkg/orm" ormModel "github.com/pingcap/tiflow/engine/pkg/orm/model" cerrors "github.com/pingcap/tiflow/pkg/errors" + "go.uber.org/zap" + "gorm.io/gorm" + "gorm.io/gorm/clause" ) // Where clause for meta kv option diff --git a/engine/pkg/notifier/notifier.go b/engine/pkg/notifier/notifier.go index a3ec8a77926..d68a28a293f 100644 --- a/engine/pkg/notifier/notifier.go +++ b/engine/pkg/notifier/notifier.go @@ -19,9 +19,8 @@ import ( "time" "github.com/pingcap/errors" - "go.uber.org/atomic" - "github.com/pingcap/tiflow/engine/pkg/containers" + "go.uber.org/atomic" ) type receiverID = int64 diff --git a/engine/pkg/orm/client.go b/engine/pkg/orm/client.go index 7dc337660c6..ae94fcc728a 100644 --- a/engine/pkg/orm/client.go +++ b/engine/pkg/orm/client.go @@ -19,9 +19,6 @@ import ( gerrors "errors" "time" - "gorm.io/gorm" - "gorm.io/gorm/clause" - frameModel "github.com/pingcap/tiflow/engine/framework/model" engineModel "github.com/pingcap/tiflow/engine/model" resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" @@ -29,6 +26,8 @@ import ( "github.com/pingcap/tiflow/engine/pkg/orm/model" execModel "github.com/pingcap/tiflow/engine/servermaster/executormeta/model" "github.com/pingcap/tiflow/pkg/errors" + "gorm.io/gorm" + "gorm.io/gorm/clause" ) var globalModels = []interface{}{ diff --git a/engine/pkg/orm/client_test.go b/engine/pkg/orm/client_test.go index 24556e911af..30ff8f831db 100644 --- a/engine/pkg/orm/client_test.go +++ b/engine/pkg/orm/client_test.go @@ -24,14 +24,10 @@ import ( "testing" "time" - "github.com/pingcap/tiflow/pkg/label" - "github.com/DATA-DOG/go-sqlmock" "github.com/go-sql-driver/mysql" perrors "github.com/pingcap/errors" "github.com/pingcap/failpoint" - "github.com/stretchr/testify/require" - frameModel "github.com/pingcap/tiflow/engine/framework/model" engineModel "github.com/pingcap/tiflow/engine/model" resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" @@ -39,6 +35,8 @@ import ( metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" "github.com/pingcap/tiflow/engine/pkg/orm/model" derror "github.com/pingcap/tiflow/pkg/errors" + "github.com/pingcap/tiflow/pkg/label" + "github.com/stretchr/testify/require" ) const ( diff --git a/engine/pkg/orm/mock.go b/engine/pkg/orm/mock.go index 386bfb88ec0..4367282bed8 100644 --- a/engine/pkg/orm/mock.go +++ b/engine/pkg/orm/mock.go @@ -19,11 +19,10 @@ import ( "time" "github.com/pingcap/log" - "go.uber.org/zap" - "github.com/pingcap/tiflow/engine/pkg/meta/mock" metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" "github.com/pingcap/tiflow/pkg/uuid" + "go.uber.org/zap" ) func randomDBFile() string { diff --git a/engine/pkg/orm/util.go b/engine/pkg/orm/util.go index 9e9418c930e..dfe3f37e083 100644 --- a/engine/pkg/orm/util.go +++ b/engine/pkg/orm/util.go @@ -21,15 +21,13 @@ import ( "github.com/glebarez/sqlite" "github.com/pingcap/failpoint" - "gorm.io/driver/mysql" - "gorm.io/gorm" - dmutils "github.com/pingcap/tiflow/dm/pkg/utils" // TODO: move it to pkg - "github.com/pingcap/tiflow/engine/pkg/meta/model" metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" ormModel "github.com/pingcap/tiflow/engine/pkg/orm/model" "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/logutil" + "gorm.io/driver/mysql" + "gorm.io/gorm" ) var defaultSlowLogThreshold = 200 * time.Millisecond @@ -65,7 +63,7 @@ func InitAllFrameworkModels(ctx context.Context, cc metaModel.ClientConn) error // InitEpochModel creates the backend logic epoch table if not exists // Only use for business meta currently // NOT thread-safe -func InitEpochModel(ctx context.Context, cc model.ClientConn) error { +func InitEpochModel(ctx context.Context, cc metaModel.ClientConn) error { gormDB, err := genGormDBFromClientConn(cc) if err != nil { return err @@ -78,7 +76,7 @@ func InitEpochModel(ctx context.Context, cc model.ClientConn) error { return nil } -func genGormDBFromClientConn(cc model.ClientConn) (*gorm.DB, error) { +func genGormDBFromClientConn(cc metaModel.ClientConn) (*gorm.DB, error) { if cc == nil { return nil, errors.ErrMetaParamsInvalid.GenWithStackByArgs("input client conn is nil") } diff --git a/engine/pkg/promutil/registry.go b/engine/pkg/promutil/registry.go index de02bd331d8..acfcb1195dd 100644 --- a/engine/pkg/promutil/registry.go +++ b/engine/pkg/promutil/registry.go @@ -16,11 +16,10 @@ package promutil import ( "sync" + frameModel "github.com/pingcap/tiflow/engine/framework/model" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" dto "github.com/prometheus/client_model/go" - - frameModel "github.com/pingcap/tiflow/engine/framework/model" ) var _ prometheus.Gatherer = globalMetricGatherer diff --git a/engine/pkg/promutil/util_inner.go b/engine/pkg/promutil/util_inner.go index f96a12034c6..d6ef02544e0 100644 --- a/engine/pkg/promutil/util_inner.go +++ b/engine/pkg/promutil/util_inner.go @@ -16,12 +16,11 @@ package promutil import ( "net/http" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" - frameModel "github.com/pingcap/tiflow/engine/framework/model" engineModel "github.com/pingcap/tiflow/engine/model" "github.com/pingcap/tiflow/engine/pkg/tenant" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" ) // [NOTICE]: SHOULD NOT use following functions. USE functions in 'util.go' INSTEAD. diff --git a/engine/pkg/rpcutil/client.go b/engine/pkg/rpcutil/client.go index 905e9b4a553..a2134aa1a5e 100644 --- a/engine/pkg/rpcutil/client.go +++ b/engine/pkg/rpcutil/client.go @@ -19,11 +19,10 @@ import ( "sync" "github.com/pingcap/log" - "go.uber.org/zap" - "google.golang.org/grpc" - "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/retry" + "go.uber.org/zap" + "google.golang.org/grpc" ) const defaultDialRetry = 3 diff --git a/engine/pkg/rpcutil/client_test.go b/engine/pkg/rpcutil/client_test.go index 47ad1e7a273..195c0814f0f 100644 --- a/engine/pkg/rpcutil/client_test.go +++ b/engine/pkg/rpcutil/client_test.go @@ -17,11 +17,10 @@ import ( "context" "testing" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" - "github.com/pingcap/errors" derror "github.com/pingcap/tiflow/pkg/errors" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" ) type ( diff --git a/engine/pkg/rpcutil/server.go b/engine/pkg/rpcutil/server.go index 62c6cd8670c..72de84f2b53 100644 --- a/engine/pkg/rpcutil/server.go +++ b/engine/pkg/rpcutil/server.go @@ -23,12 +23,11 @@ import ( "time" "github.com/pingcap/log" + pb "github.com/pingcap/tiflow/engine/enginepb" + "github.com/pingcap/tiflow/pkg/errors" "go.uber.org/atomic" "go.uber.org/zap" "golang.org/x/time/rate" - - pb "github.com/pingcap/tiflow/engine/enginepb" - "github.com/pingcap/tiflow/pkg/errors" ) // Member stores server member information diff --git a/engine/servermaster/config.go b/engine/servermaster/config.go index 154ed2cf840..a51fff3dfa2 100644 --- a/engine/servermaster/config.go +++ b/engine/servermaster/config.go @@ -23,14 +23,13 @@ import ( "github.com/BurntSushi/toml" validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/pingcap/log" - "go.uber.org/zap" - resModel "github.com/pingcap/tiflow/engine/pkg/externalresource/model" metaModel "github.com/pingcap/tiflow/engine/pkg/meta/model" "github.com/pingcap/tiflow/engine/servermaster/jobop" "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/logutil" "github.com/pingcap/tiflow/pkg/security" + "go.uber.org/zap" ) const ( diff --git a/engine/servermaster/http.go b/engine/servermaster/http.go index 98dfbc26a3b..9456aadf499 100644 --- a/engine/servermaster/http.go +++ b/engine/servermaster/http.go @@ -20,7 +20,6 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/pingcap/failpoint" - "github.com/pingcap/tiflow/engine/pkg/openapi" "github.com/pingcap/tiflow/engine/pkg/promutil" "github.com/pingcap/tiflow/pkg/util" diff --git a/engine/servermaster/job_fsm.go b/engine/servermaster/job_fsm.go index 846124c2a05..d30a23296e1 100644 --- a/engine/servermaster/job_fsm.go +++ b/engine/servermaster/job_fsm.go @@ -20,8 +20,7 @@ import ( pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/framework" frameModel "github.com/pingcap/tiflow/engine/framework/model" - cerrors "github.com/pingcap/tiflow/pkg/errors" - derrors "github.com/pingcap/tiflow/pkg/errors" + "github.com/pingcap/tiflow/pkg/errors" "go.uber.org/zap" ) @@ -159,10 +158,10 @@ func (fsm *JobFsm) IterPendingJobs(dispatchJobFn func(job *frameModel.MasterMeta id, err := dispatchJobFn(job) if err != nil { // This job is being backoff, skip it and process other jobs. - if derrors.ErrMasterCreateWorkerBackoff.Equal(err) { + if errors.ErrMasterCreateWorkerBackoff.Equal(err) { continue } - if derrors.ErrMasterCreateWorkerTerminate.Equal(err) { + if errors.ErrMasterCreateWorkerTerminate.Equal(err) { delete(fsm.pendingJobs, oldJobID) continue } @@ -206,7 +205,7 @@ func (fsm *JobFsm) JobOnline(worker framework.WorkerHandle) error { job, ok := fsm.waitAckJobs[worker.ID()] if !ok { - return cerrors.ErrWorkerNotFound.GenWithStackByArgs(worker.ID()) + return errors.ErrWorkerNotFound.GenWithStackByArgs(worker.ID()) } fsm.onlineJobs[worker.ID()] = &JobHolder{ workerHandle: worker, @@ -244,7 +243,7 @@ func (fsm *JobFsm) JobDispatchFailed(worker framework.WorkerHandle) error { job, ok := fsm.waitAckJobs[worker.ID()] if !ok { - return cerrors.ErrWorkerNotFound.GenWithStackByArgs(worker.ID()) + return errors.ErrWorkerNotFound.GenWithStackByArgs(worker.ID()) } fsm.pendingJobs[worker.ID()] = job.masterMeta delete(fsm.waitAckJobs, worker.ID()) diff --git a/engine/servermaster/jobmanager.go b/engine/servermaster/jobmanager.go index 19bcad025ba..2900aac1972 100644 --- a/engine/servermaster/jobmanager.go +++ b/engine/servermaster/jobmanager.go @@ -20,17 +20,8 @@ import ( "sort" "time" - schedModel "github.com/pingcap/tiflow/engine/servermaster/scheduler/model" - "github.com/pingcap/tiflow/pkg/label" - "github.com/pingcap/errors" "github.com/pingcap/log" - "go.uber.org/zap" - "golang.org/x/sync/errgroup" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/emptypb" - pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/executor/cvs" "github.com/pingcap/tiflow/engine/framework" @@ -48,10 +39,17 @@ import ( "github.com/pingcap/tiflow/engine/pkg/p2p" "github.com/pingcap/tiflow/engine/pkg/tenant" "github.com/pingcap/tiflow/engine/servermaster/jobop" + schedModel "github.com/pingcap/tiflow/engine/servermaster/scheduler/model" derrors "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/httputil" + "github.com/pingcap/tiflow/pkg/label" "github.com/pingcap/tiflow/pkg/notify" "github.com/pingcap/tiflow/pkg/uuid" + "go.uber.org/zap" + "golang.org/x/sync/errgroup" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" ) // JobManager defines manager of job master diff --git a/engine/servermaster/jobmanager_test.go b/engine/servermaster/jobmanager_test.go index 05e32c51ffb..0441960a88b 100644 --- a/engine/servermaster/jobmanager_test.go +++ b/engine/servermaster/jobmanager_test.go @@ -20,13 +20,6 @@ import ( "time" "github.com/golang/mock/gomock" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" - "golang.org/x/sync/errgroup" - "google.golang.org/protobuf/proto" - - "github.com/pingcap/tiflow/engine/enginepb" pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/framework" "github.com/pingcap/tiflow/engine/framework/metadata" @@ -45,6 +38,11 @@ import ( "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/notify" "github.com/pingcap/tiflow/pkg/uuid" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" + "golang.org/x/sync/errgroup" + "google.golang.org/protobuf/proto" ) func prepareMockJobManager( @@ -506,8 +504,8 @@ func TestGetJobDetailFromJobMaster(t *testing.T) { require.NoError(t, err) require.True(t, proto.Equal(&pb.Job{ Id: "new-job", - Type: enginepb.Job_FakeJob, - State: enginepb.Job_Running, + Type: pb.Job_FakeJob, + State: pb.Job_Running, Detail: []byte("detail test"), Error: &pb.Error{ Message: "error_message", @@ -530,8 +528,8 @@ func TestGetJobDetailFromJobMaster(t *testing.T) { require.NoError(t, err) require.True(t, proto.Equal(&pb.Job{ Id: "new-job", - Type: enginepb.Job_FakeJob, - State: enginepb.Job_Running, + Type: pb.Job_FakeJob, + State: pb.Job_Running, Error: &pb.Error{ Message: "error_message", }, @@ -553,8 +551,8 @@ func TestGetJobDetailFromJobMaster(t *testing.T) { require.NoError(t, err) require.True(t, proto.Equal(&pb.Job{ Id: "new-job", - Type: enginepb.Job_FakeJob, - State: enginepb.Job_Running, + Type: pb.Job_FakeJob, + State: pb.Job_Running, Error: &pb.Error{ Message: "error test", }, diff --git a/engine/servermaster/jobop/operator.go b/engine/servermaster/jobop/operator.go index 34760ea3ac1..ec731ace54e 100644 --- a/engine/servermaster/jobop/operator.go +++ b/engine/servermaster/jobop/operator.go @@ -14,14 +14,13 @@ package jobop import ( - "go.uber.org/multierr" - "go.uber.org/zap" - "golang.org/x/net/context" - "github.com/pingcap/log" frameworkModel "github.com/pingcap/tiflow/engine/framework/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" ormModel "github.com/pingcap/tiflow/engine/pkg/orm/model" + "go.uber.org/multierr" + "go.uber.org/zap" + "golang.org/x/net/context" ) type operateRouter interface { diff --git a/engine/servermaster/jobop/operator_test.go b/engine/servermaster/jobop/operator_test.go index 0c97611612c..1d8cede654c 100644 --- a/engine/servermaster/jobop/operator_test.go +++ b/engine/servermaster/jobop/operator_test.go @@ -16,14 +16,12 @@ package jobop import ( "testing" - "github.com/stretchr/testify/require" - "golang.org/x/net/context" - frameModel "github.com/pingcap/tiflow/engine/framework/model" - frameworkModel "github.com/pingcap/tiflow/engine/framework/model" pkgOrm "github.com/pingcap/tiflow/engine/pkg/orm" ormModel "github.com/pingcap/tiflow/engine/pkg/orm/model" "github.com/pingcap/tiflow/pkg/errors" + "github.com/stretchr/testify/require" + "golang.org/x/net/context" ) type mockOperatorRouter struct { @@ -56,14 +54,14 @@ func (r *mockOperatorRouter) checkCancelCalls(t *testing.T, jobID string, expect } func (r *mockOperatorRouter) jobOnline( - ctx context.Context, jobID string, meta *frameworkModel.MasterMeta, + ctx context.Context, jobID string, meta *frameModel.MasterMeta, ) error { r.onlineJobs[jobID] = struct{}{} return r.cli.UpsertJob(ctx, meta) } func (r *mockOperatorRouter) jobOffline( - ctx context.Context, jobID string, meta *frameworkModel.MasterMeta, + ctx context.Context, jobID string, meta *frameModel.MasterMeta, ) error { delete(r.onlineJobs, jobID) return r.cli.UpsertJob(ctx, meta) @@ -88,10 +86,10 @@ func TestJobOperator(t *testing.T) { oper := NewJobOperatorImpl(metaCli, router) jobID := "cancel-job-id" - meta := &frameworkModel.MasterMeta{ + meta := &frameModel.MasterMeta{ ID: jobID, Type: frameModel.CvsJobMaster, - State: frameworkModel.MasterStateInit, + State: frameModel.MasterStateInit, } err = router.jobOnline(ctx, jobID, meta) require.NoError(t, err) @@ -112,7 +110,7 @@ func TestJobOperator(t *testing.T) { } // mock job master is canceled and status persisted - meta.State = frameworkModel.MasterStateStopped + meta.State = frameModel.MasterStateStopped err = router.jobOffline(ctx, jobID, meta) require.NoError(t, err) diff --git a/engine/servermaster/server.go b/engine/servermaster/server.go index 8abe311e1e0..4eb593dce27 100644 --- a/engine/servermaster/server.go +++ b/engine/servermaster/server.go @@ -29,17 +29,6 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus" - "go.uber.org/atomic" - "go.uber.org/zap" - "golang.org/x/sync/errgroup" - "golang.org/x/time/rate" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/types/known/emptypb" - pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/framework/metadata" frameModel "github.com/pingcap/tiflow/engine/framework/model" @@ -69,6 +58,16 @@ import ( "github.com/pingcap/tiflow/pkg/security" "github.com/pingcap/tiflow/pkg/tcpserver" p2pProtocol "github.com/pingcap/tiflow/proto/p2p" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/atomic" + "go.uber.org/zap" + "golang.org/x/sync/errgroup" + "golang.org/x/time/rate" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/types/known/emptypb" ) // TODO: make it configurable in the future. diff --git a/engine/test/e2e/e2e_dm_test.go b/engine/test/e2e/e2e_dm_test.go index f766f8aa533..40d0141eaba 100644 --- a/engine/test/e2e/e2e_dm_test.go +++ b/engine/test/e2e/e2e_dm_test.go @@ -31,8 +31,6 @@ import ( "time" gmysql "github.com/go-mysql-org/go-mysql/mysql" - "github.com/stretchr/testify/require" - "github.com/pingcap/tiflow/dm/pkg/conn" tcontext "github.com/pingcap/tiflow/dm/pkg/context" pb "github.com/pingcap/tiflow/engine/enginepb" @@ -43,6 +41,7 @@ import ( "github.com/pingcap/tiflow/engine/test/e2e" "github.com/pingcap/tiflow/pkg/httputil" "github.com/pingcap/tiflow/tests/integration_tests/util" + "github.com/stretchr/testify/require" ) const ( diff --git a/engine/test/e2e/e2e_node_chaos_test.go b/engine/test/e2e/e2e_node_chaos_test.go index fc7e2a08907..dc9e61c100a 100644 --- a/engine/test/e2e/e2e_node_chaos_test.go +++ b/engine/test/e2e/e2e_node_chaos_test.go @@ -22,13 +22,12 @@ import ( "time" "github.com/pingcap/log" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/framework/fake" "github.com/pingcap/tiflow/engine/pkg/tenant" "github.com/pingcap/tiflow/engine/test/e2e" + "github.com/stretchr/testify/require" + "go.uber.org/zap" ) var DefaultTimeoutForTest = 3 * time.Second diff --git a/engine/test/e2e/e2e_test.go b/engine/test/e2e/e2e_test.go index 5dae0ed3f0f..50718d439be 100644 --- a/engine/test/e2e/e2e_test.go +++ b/engine/test/e2e/e2e_test.go @@ -22,12 +22,11 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" - pb "github.com/pingcap/tiflow/engine/enginepb" cvs "github.com/pingcap/tiflow/engine/jobmaster/cvsjob" "github.com/pingcap/tiflow/engine/test/e2e" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" ) type Config struct { diff --git a/engine/test/e2e/e2e_worker_exit_test.go b/engine/test/e2e/e2e_worker_exit_test.go index 3f70501bec4..556122cbed0 100644 --- a/engine/test/e2e/e2e_worker_exit_test.go +++ b/engine/test/e2e/e2e_worker_exit_test.go @@ -20,13 +20,12 @@ import ( "time" "github.com/pingcap/log" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - pb "github.com/pingcap/tiflow/engine/enginepb" "github.com/pingcap/tiflow/engine/framework/fake" "github.com/pingcap/tiflow/engine/pkg/tenant" "github.com/pingcap/tiflow/engine/test/e2e" + "github.com/stretchr/testify/require" + "go.uber.org/zap" ) func TestWorkerExit(t *testing.T) { diff --git a/engine/test/mock/grpc.go b/engine/test/mock/grpc.go index 5df045dc751..b00d3a5a451 100644 --- a/engine/test/mock/grpc.go +++ b/engine/test/mock/grpc.go @@ -19,10 +19,9 @@ import ( "sync" "github.com/pingcap/log" + pb "github.com/pingcap/tiflow/engine/enginepb" "go.uber.org/zap" "google.golang.org/grpc" - - pb "github.com/pingcap/tiflow/engine/enginepb" ) var container *grpcContainer diff --git a/engine/test/util_test.go b/engine/test/util_test.go index afeab4c5d15..1e2a0b5cc77 100644 --- a/engine/test/util_test.go +++ b/engine/test/util_test.go @@ -20,7 +20,6 @@ import ( "github.com/phayes/freeport" . "github.com/pingcap/check" - "github.com/pingcap/tiflow/engine/executor" "github.com/pingcap/tiflow/engine/servermaster" "github.com/pingcap/tiflow/engine/test" diff --git a/pkg/cmd/cli/cli_changefeed_query.go b/pkg/cmd/cli/cli_changefeed_query.go index 68b216e7856..e02e23dccb9 100644 --- a/pkg/cmd/cli/cli_changefeed_query.go +++ b/pkg/cmd/cli/cli_changefeed_query.go @@ -21,7 +21,6 @@ import ( "github.com/pingcap/tiflow/cdc/model" apiv1client "github.com/pingcap/tiflow/pkg/api/v1" apiv2client "github.com/pingcap/tiflow/pkg/api/v2" - "github.com/pingcap/tiflow/pkg/cmd/factory" "github.com/pingcap/tiflow/pkg/cmd/util" cerror "github.com/pingcap/tiflow/pkg/errors" diff --git a/pkg/cmd/cli/cli_changefeed_resume_test.go b/pkg/cmd/cli/cli_changefeed_resume_test.go index 3e8ad611597..029260f8f07 100644 --- a/pkg/cmd/cli/cli_changefeed_resume_test.go +++ b/pkg/cmd/cli/cli_changefeed_resume_test.go @@ -22,9 +22,8 @@ import ( "github.com/golang/mock/gomock" "github.com/pingcap/errors" v2 "github.com/pingcap/tiflow/cdc/api/v2" - cerror "github.com/pingcap/tiflow/pkg/errors" - "github.com/pingcap/tiflow/cdc/model" + cerror "github.com/pingcap/tiflow/pkg/errors" "github.com/stretchr/testify/require" "github.com/tikv/client-go/v2/oracle" ) diff --git a/pkg/cmd/factory/factory_impl.go b/pkg/cmd/factory/factory_impl.go index 31ed068cbb8..370087f0c4d 100644 --- a/pkg/cmd/factory/factory_impl.go +++ b/pkg/cmd/factory/factory_impl.go @@ -22,19 +22,18 @@ import ( "github.com/pingcap/log" apiv1client "github.com/pingcap/tiflow/pkg/api/v1" apiv2client "github.com/pingcap/tiflow/pkg/api/v2" + cmdconetxt "github.com/pingcap/tiflow/pkg/cmd/context" "github.com/pingcap/tiflow/pkg/cmd/util" cerror "github.com/pingcap/tiflow/pkg/errors" + "github.com/pingcap/tiflow/pkg/etcd" + "github.com/pingcap/tiflow/pkg/security" + "github.com/pingcap/tiflow/pkg/version" pd "github.com/tikv/pd/client" etcdlogutil "go.etcd.io/etcd/client/pkg/v3/logutil" clientv3 "go.etcd.io/etcd/client/v3" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/backoff" - - cmdconetxt "github.com/pingcap/tiflow/pkg/cmd/context" - "github.com/pingcap/tiflow/pkg/etcd" - "github.com/pingcap/tiflow/pkg/security" - "github.com/pingcap/tiflow/pkg/version" ) const ( diff --git a/pkg/config/sink.go b/pkg/config/sink.go index bb8f648a917..35bbfc3dde0 100644 --- a/pkg/config/sink.go +++ b/pkg/config/sink.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/log" cerror "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/sink" - "go.uber.org/zap" ) diff --git a/pkg/errors/reflect_test.go b/pkg/errors/reflect_test.go index b685c562fa8..35fd1381370 100644 --- a/pkg/errors/reflect_test.go +++ b/pkg/errors/reflect_test.go @@ -17,7 +17,6 @@ import ( "testing" "github.com/pingcap/errors" - perrors "github.com/pingcap/errors" "github.com/pingcap/tiflow/dm/pkg/terror" "github.com/stretchr/testify/require" ) @@ -54,6 +53,6 @@ func TestToDMError(t *testing.T) { } // Non DM error - err := perrors.New("normal error") + err := errors.New("normal error") require.Equal(t, err, ToDMError(err)) } diff --git a/pkg/errorutil/util.go b/pkg/errorutil/util.go index 130f50118a1..f5bf770a69d 100644 --- a/pkg/errorutil/util.go +++ b/pkg/errorutil/util.go @@ -16,15 +16,14 @@ package errorutil import ( "strings" - "github.com/pingcap/tidb/util/dbutil" - dmretry "github.com/pingcap/tiflow/dm/pkg/retry" - cerror "github.com/pingcap/tiflow/pkg/errors" - gmysql "github.com/go-sql-driver/mysql" "github.com/pingcap/errors" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/util/dbterror" + "github.com/pingcap/tidb/util/dbutil" + dmretry "github.com/pingcap/tiflow/dm/pkg/retry" + cerror "github.com/pingcap/tiflow/pkg/errors" v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" ) diff --git a/pkg/etcd/etcd.go b/pkg/etcd/etcd.go index c1a6746b0b2..e966b9f5968 100644 --- a/pkg/etcd/etcd.go +++ b/pkg/etcd/etcd.go @@ -20,7 +20,11 @@ import ( "strings" "time" + "github.com/pingcap/errors" + "github.com/pingcap/log" + "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/pkg/config" + cerror "github.com/pingcap/tiflow/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/tikv/pd/pkg/tempurl" "go.etcd.io/etcd/api/v3/mvccpb" @@ -30,11 +34,6 @@ import ( "go.etcd.io/etcd/server/v3/embed" "go.uber.org/zap" "google.golang.org/grpc/codes" - - "github.com/pingcap/errors" - "github.com/pingcap/log" - "github.com/pingcap/tiflow/cdc/model" - cerror "github.com/pingcap/tiflow/pkg/errors" ) // DefaultCDCClusterID is the default value of cdc cluster id diff --git a/pkg/filter/filter_test.go b/pkg/filter/filter_test.go index 331a6de1ecc..f449cc2be69 100644 --- a/pkg/filter/filter_test.go +++ b/pkg/filter/filter_test.go @@ -16,11 +16,10 @@ package filter import ( "testing" - "github.com/pingcap/tiflow/cdc/model" - "github.com/pingcap/tiflow/pkg/config" - bf "github.com/pingcap/tidb-tools/pkg/binlog-filter" timodel "github.com/pingcap/tidb/parser/model" + "github.com/pingcap/tiflow/cdc/model" + "github.com/pingcap/tiflow/pkg/config" "github.com/stretchr/testify/require" ) diff --git a/pkg/filter/filter_test_helper.go b/pkg/filter/filter_test_helper.go index 6258a36df7f..47a930a4595 100644 --- a/pkg/filter/filter_test_helper.go +++ b/pkg/filter/filter_test_helper.go @@ -25,10 +25,9 @@ import ( "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/testkit" + "github.com/pingcap/tiflow/cdc/model" "github.com/stretchr/testify/require" "github.com/tikv/client-go/v2/oracle" - - "github.com/pingcap/tiflow/cdc/model" ) // testHelper is a test helper for filter which creates diff --git a/pkg/httputil/httputil_test.go b/pkg/httputil/httputil_test.go index 756617996da..7e72c5a10c3 100644 --- a/pkg/httputil/httputil_test.go +++ b/pkg/httputil/httputil_test.go @@ -24,10 +24,9 @@ import ( "path/filepath" "testing" + "github.com/pingcap/tidb/util" "github.com/pingcap/tiflow/pkg/security" "github.com/stretchr/testify/require" - - "github.com/pingcap/tidb/util" ) var httputilServerMsg = "this is httputil test server" diff --git a/pkg/orchestrator/etcd_worker_test.go b/pkg/orchestrator/etcd_worker_test.go index 639a36439ec..e4038c487f7 100644 --- a/pkg/orchestrator/etcd_worker_test.go +++ b/pkg/orchestrator/etcd_worker_test.go @@ -25,17 +25,16 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" + cerrors "github.com/pingcap/tiflow/pkg/errors" + "github.com/pingcap/tiflow/pkg/etcd" "github.com/pingcap/tiflow/pkg/migrate" + "github.com/pingcap/tiflow/pkg/orchestrator/util" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" clientv3 "go.etcd.io/etcd/client/v3" "go.uber.org/zap" "golang.org/x/sync/errgroup" - - cerrors "github.com/pingcap/tiflow/pkg/errors" - "github.com/pingcap/tiflow/pkg/etcd" - "github.com/pingcap/tiflow/pkg/orchestrator/util" ) const ( diff --git a/pkg/p2p/server.go b/pkg/p2p/server.go index 639da05a777..37fbae39306 100755 --- a/pkg/p2p/server.go +++ b/pkg/p2p/server.go @@ -24,6 +24,8 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/log" cerror "github.com/pingcap/tiflow/pkg/errors" + "github.com/pingcap/tiflow/pkg/workerpool" + "github.com/pingcap/tiflow/proto/p2p" "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" "golang.org/x/sync/errgroup" @@ -31,9 +33,6 @@ import ( "google.golang.org/grpc/codes" gRPCPeer "google.golang.org/grpc/peer" "google.golang.org/grpc/status" - - "github.com/pingcap/tiflow/pkg/workerpool" - "github.com/pingcap/tiflow/proto/p2p" ) const ( diff --git a/pkg/p2p/server_client_integration_test.go b/pkg/p2p/server_client_integration_test.go index 9e4d89a57d9..7c1ce2edb5f 100644 --- a/pkg/p2p/server_client_integration_test.go +++ b/pkg/p2p/server_client_integration_test.go @@ -22,16 +22,15 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - "google.golang.org/grpc" - "github.com/phayes/freeport" "github.com/pingcap/failpoint" "github.com/pingcap/log" cerror "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tiflow/pkg/security" "github.com/pingcap/tiflow/proto/p2p" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "google.golang.org/grpc" ) // read only diff --git a/pkg/p2p/server_test.go b/pkg/p2p/server_test.go index 269a7ab8fe8..a3a9819e06d 100644 --- a/pkg/p2p/server_test.go +++ b/pkg/p2p/server_test.go @@ -25,10 +25,9 @@ import ( "time" "github.com/phayes/freeport" + "github.com/pingcap/tiflow/proto/p2p" "github.com/stretchr/testify/require" "google.golang.org/grpc" - - "github.com/pingcap/tiflow/proto/p2p" ) const ( diff --git a/pkg/sqlmodel/causality.go b/pkg/sqlmodel/causality.go index 6d79db670a5..d943ff949c6 100644 --- a/pkg/sqlmodel/causality.go +++ b/pkg/sqlmodel/causality.go @@ -21,10 +21,9 @@ import ( timodel "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/tablecodec" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" + "go.uber.org/zap" ) // CausalityKeys returns all string representation of causality keys. If two row diff --git a/pkg/sqlmodel/causality_test.go b/pkg/sqlmodel/causality_test.go index 3c983bef6e8..4ef0ef83ea3 100644 --- a/pkg/sqlmodel/causality_test.go +++ b/pkg/sqlmodel/causality_test.go @@ -17,9 +17,8 @@ import ( "sync" "testing" - "github.com/stretchr/testify/require" - cdcmodel "github.com/pingcap/tiflow/cdc/model" + "github.com/stretchr/testify/require" ) func TestCausalityKeys(t *testing.T) { diff --git a/pkg/sqlmodel/multirow.go b/pkg/sqlmodel/multirow.go index 2673916bdbb..0f7341bf749 100644 --- a/pkg/sqlmodel/multirow.go +++ b/pkg/sqlmodel/multirow.go @@ -21,10 +21,9 @@ import ( "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/parser/opcode" driver "github.com/pingcap/tidb/types/parser_driver" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/pkg/quotes" + "go.uber.org/zap" ) // SameTypeTargetAndColumns check whether two row changes have same type, target diff --git a/pkg/sqlmodel/multirow_test.go b/pkg/sqlmodel/multirow_test.go index d848be18dd2..52500da6758 100644 --- a/pkg/sqlmodel/multirow_test.go +++ b/pkg/sqlmodel/multirow_test.go @@ -16,9 +16,8 @@ package sqlmodel import ( "testing" - "github.com/stretchr/testify/require" - cdcmodel "github.com/pingcap/tiflow/cdc/model" + "github.com/stretchr/testify/require" ) func TestGenDeleteMultiRows(t *testing.T) { diff --git a/pkg/sqlmodel/reduce.go b/pkg/sqlmodel/reduce.go index 96b8b6dfb7e..787affd1841 100644 --- a/pkg/sqlmodel/reduce.go +++ b/pkg/sqlmodel/reduce.go @@ -16,9 +16,8 @@ package sqlmodel import ( "strings" - "go.uber.org/zap" - "github.com/pingcap/tiflow/dm/pkg/log" + "go.uber.org/zap" ) // HasNotNullUniqueIdx returns true when the target table structure has PK or UK diff --git a/pkg/sqlmodel/reduce_test.go b/pkg/sqlmodel/reduce_test.go index fff3206dede..7589df04662 100644 --- a/pkg/sqlmodel/reduce_test.go +++ b/pkg/sqlmodel/reduce_test.go @@ -16,9 +16,8 @@ package sqlmodel import ( "testing" - "github.com/stretchr/testify/require" - cdcmodel "github.com/pingcap/tiflow/cdc/model" + "github.com/stretchr/testify/require" ) func TestIdentity(t *testing.T) { diff --git a/pkg/sqlmodel/row_change.go b/pkg/sqlmodel/row_change.go index 20d5a8767a1..883e4ef60d3 100644 --- a/pkg/sqlmodel/row_change.go +++ b/pkg/sqlmodel/row_change.go @@ -20,12 +20,11 @@ import ( "github.com/pingcap/failpoint" timodel "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/sessionctx" - "go.uber.org/zap" - cdcmodel "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" "github.com/pingcap/tiflow/pkg/quotes" + "go.uber.org/zap" ) // RowChangeType is the type of row change. diff --git a/pkg/sqlmodel/row_change_test.go b/pkg/sqlmodel/row_change_test.go index eda1f42470a..4b40c6471c2 100644 --- a/pkg/sqlmodel/row_change_test.go +++ b/pkg/sqlmodel/row_change_test.go @@ -21,12 +21,11 @@ import ( "github.com/pingcap/tidb/parser/ast" timodel "github.com/pingcap/tidb/parser/model" timock "github.com/pingcap/tidb/util/mock" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - cdcmodel "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/dm/pkg/log" "github.com/pingcap/tiflow/dm/pkg/utils" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" ) func mockTableInfo(t *testing.T, sql string) *timodel.TableInfo { diff --git a/pkg/workerpool/async_pool_test.go b/pkg/workerpool/async_pool_test.go index d39e93668d3..68ca2c015d0 100644 --- a/pkg/workerpool/async_pool_test.go +++ b/pkg/workerpool/async_pool_test.go @@ -21,11 +21,9 @@ import ( "testing" "time" - "github.com/pingcap/log" - "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/stretchr/testify/require" - "golang.org/x/sync/errgroup" ) diff --git a/tests/integration_tests/dailytest/parser.go b/tests/integration_tests/dailytest/parser.go index 5408fd126a3..17fbf662f38 100644 --- a/tests/integration_tests/dailytest/parser.go +++ b/tests/integration_tests/dailytest/parser.go @@ -23,9 +23,7 @@ import ( "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/parser/ast" "github.com/pingcap/tidb/types" - - // import parser_drive to avoid panic - _ "github.com/pingcap/tidb/types/parser_driver" + _ "github.com/pingcap/tidb/types/parser_driver" // import parser_driver to avoid panic ) type column struct { diff --git a/tests/integration_tests/http_proxies/run-proxy.go b/tests/integration_tests/http_proxies/run-proxy.go index 5e771f41871..e8bc936c826 100644 --- a/tests/integration_tests/http_proxies/run-proxy.go +++ b/tests/integration_tests/http_proxies/run-proxy.go @@ -17,10 +17,9 @@ import ( "flag" "fmt" + grpc_proxy "github.com/bradleyjkemp/grpc-tools/grpc-proxy" "github.com/pingcap/log" "go.uber.org/zap" - - grpc_proxy "github.com/bradleyjkemp/grpc-tools/grpc-proxy" "google.golang.org/grpc" ) diff --git a/tests/utils/cdc_state_checker/cdc_monitor.go b/tests/utils/cdc_state_checker/cdc_monitor.go index 6783d6dc34e..947e9fa1887 100644 --- a/tests/utils/cdc_state_checker/cdc_monitor.go +++ b/tests/utils/cdc_state_checker/cdc_monitor.go @@ -19,7 +19,10 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/pingcap/tiflow/pkg/etcd" "github.com/pingcap/tiflow/pkg/migrate" + "github.com/pingcap/tiflow/pkg/orchestrator" + "github.com/pingcap/tiflow/pkg/security" "github.com/prometheus/client_golang/prometheus" "go.etcd.io/etcd/client/pkg/v3/logutil" clientv3 "go.etcd.io/etcd/client/v3" @@ -27,10 +30,6 @@ import ( "go.uber.org/zap/zapcore" "google.golang.org/grpc" "google.golang.org/grpc/backoff" - - "github.com/pingcap/tiflow/pkg/etcd" - "github.com/pingcap/tiflow/pkg/orchestrator" - "github.com/pingcap/tiflow/pkg/security" ) type cdcMonitor struct { diff --git a/tools/Makefile b/tools/Makefile index d2c4ed5fc24..2296f3abc36 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -63,3 +63,6 @@ tools/bin/goimports: tools/check/go.mod tools/bin/protoc-gen-openapiv2: tools/check/go.mod cd tools/check && $(GO) build -mod=mod -o ../bin/protoc-gen-openapiv2 github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 + +tools/bin/gci: tools/check/go.mod + cd tools/check && $(GO) build -mod=mod -o ../bin/gci github.com/daixiang0/gci diff --git a/tools/check/tools.go b/tools/check/tools.go index 1be0c4557b6..7838dc078a6 100644 --- a/tools/check/tools.go +++ b/tools/check/tools.go @@ -23,6 +23,7 @@ import ( // make go module happy _ "github.com/AlekSi/gocov-xml" _ "github.com/axw/gocov/gocov" + _ "github.com/daixiang0/gci" _ "github.com/deepmap/oapi-codegen/cmd/oapi-codegen" _ "github.com/gogo/protobuf/protoc-gen-gogofaster" _ "github.com/golang/mock/mockgen"