diff --git a/.golangci.yml b/.golangci.yml index e13feb04ba5..a44052b22e8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -28,6 +28,7 @@ linters: - protogetter - reassign - intrange + - gci linters-settings: gocritic: # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty @@ -233,6 +234,13 @@ linters-settings: desc: "Use 'sync/atomic' instead of 'go.uber.org/atomic'" - pkg: github.com/pkg/errors desc: "Use 'github.com/pingcap/errors' instead of 'github.com/pkg/errors'" + gci: + sections: + - standard + - default + - prefix(github.com/pingcap) + - prefix(github.com/tikv/pd) + - blank issues: exclude-rules: - path: (_test\.go|pkg/mock/.*\.go|tests/.*\.go) diff --git a/client/circuitbreaker/circuit_breaker.go b/client/circuitbreaker/circuit_breaker.go index b5a4c53ebb5..26d1b642ea4 100644 --- a/client/circuitbreaker/circuit_breaker.go +++ b/client/circuitbreaker/circuit_breaker.go @@ -19,13 +19,13 @@ import ( "sync" "time" - "github.com/tikv/pd/client/errs" - "github.com/prometheus/client_golang/prometheus" - m "github.com/tikv/pd/client/metrics" "go.uber.org/zap" "github.com/pingcap/log" + + "github.com/tikv/pd/client/errs" + m "github.com/tikv/pd/client/metrics" ) // Overloading is a type describing service return value diff --git a/client/circuitbreaker/circuit_breaker_test.go b/client/circuitbreaker/circuit_breaker_test.go index ca77b7f9f99..6a726028cd8 100644 --- a/client/circuitbreaker/circuit_breaker_test.go +++ b/client/circuitbreaker/circuit_breaker_test.go @@ -18,9 +18,9 @@ import ( "testing" "time" - "github.com/tikv/pd/client/errs" - "github.com/stretchr/testify/require" + + "github.com/tikv/pd/client/errs" ) // advance emulate the state machine clock moves forward by the given duration diff --git a/client/client.go b/client/client.go index 519fd478bb3..31bc72c0a77 100644 --- a/client/client.go +++ b/client/client.go @@ -22,15 +22,17 @@ import ( "sync" "time" - cb "github.com/tikv/pd/client/circuitbreaker" - "github.com/opentracing/opentracing-go" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus" + + cb "github.com/tikv/pd/client/circuitbreaker" "github.com/tikv/pd/client/clients/metastorage" "github.com/tikv/pd/client/clients/router" "github.com/tikv/pd/client/clients/tso" @@ -41,7 +43,6 @@ import ( "github.com/tikv/pd/client/pkg/caller" "github.com/tikv/pd/client/pkg/utils/tlsutil" sd "github.com/tikv/pd/client/servicediscovery" - "go.uber.org/zap" ) // GlobalConfigItem standard format of KV pair in GlobalConfig client diff --git a/client/client_test.go b/client/client_test.go index f4f914900cd..305d054fa18 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -20,11 +20,12 @@ import ( "time" "github.com/stretchr/testify/require" + "go.uber.org/goleak" + "github.com/tikv/pd/client/opt" "github.com/tikv/pd/client/pkg/caller" "github.com/tikv/pd/client/pkg/utils/testutil" "github.com/tikv/pd/client/pkg/utils/tsoutil" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/client/clients/metastorage/client.go b/client/clients/metastorage/client.go index dba1127f9f5..baac1ab7539 100644 --- a/client/clients/metastorage/client.go +++ b/client/clients/metastorage/client.go @@ -18,6 +18,7 @@ import ( "context" "github.com/pingcap/kvproto/pkg/meta_storagepb" + "github.com/tikv/pd/client/opt" ) diff --git a/client/clients/router/client.go b/client/clients/router/client.go index 667c82a6805..48cebfa950e 100644 --- a/client/clients/router/client.go +++ b/client/clients/router/client.go @@ -20,6 +20,7 @@ import ( "net/url" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/client/opt" ) diff --git a/client/clients/tso/client.go b/client/clients/tso/client.go index 68e2163d191..c26dd25f2ad 100644 --- a/client/clients/tso/client.go +++ b/client/clients/tso/client.go @@ -22,9 +22,16 @@ import ( "sync/atomic" "time" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + healthpb "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/status" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/client/constants" "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/metrics" @@ -32,11 +39,6 @@ import ( "github.com/tikv/pd/client/pkg/utils/grpcutil" "github.com/tikv/pd/client/pkg/utils/tlsutil" sd "github.com/tikv/pd/client/servicediscovery" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - healthpb "google.golang.org/grpc/health/grpc_health_v1" - "google.golang.org/grpc/status" ) const ( diff --git a/client/clients/tso/dispatcher.go b/client/clients/tso/dispatcher.go index 1b805395904..bdac8096f85 100644 --- a/client/clients/tso/dispatcher.go +++ b/client/clients/tso/dispatcher.go @@ -25,9 +25,12 @@ import ( "time" "github.com/opentracing/opentracing-go" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/client/constants" "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/metrics" @@ -37,7 +40,6 @@ import ( "github.com/tikv/pd/client/pkg/utils/timerutil" "github.com/tikv/pd/client/pkg/utils/tsoutil" sd "github.com/tikv/pd/client/servicediscovery" - "go.uber.org/zap" ) // deadline is used to control the TS request timeout manually, diff --git a/client/clients/tso/dispatcher_test.go b/client/clients/tso/dispatcher_test.go index 2b5fd1e52e8..cefc53f3944 100644 --- a/client/clients/tso/dispatcher_test.go +++ b/client/clients/tso/dispatcher_test.go @@ -22,13 +22,15 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" - "github.com/pingcap/log" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/zap/zapcore" + + "github.com/pingcap/failpoint" + "github.com/pingcap/log" + "github.com/tikv/pd/client/opt" sd "github.com/tikv/pd/client/servicediscovery" - "go.uber.org/zap/zapcore" ) type mockTSOServiceProvider struct { diff --git a/client/clients/tso/request.go b/client/clients/tso/request.go index 0c9f54f8b2b..9c0d8e6bea6 100644 --- a/client/clients/tso/request.go +++ b/client/clients/tso/request.go @@ -21,6 +21,7 @@ import ( "time" "github.com/pingcap/errors" + "github.com/tikv/pd/client/metrics" ) diff --git a/client/clients/tso/request_test.go b/client/clients/tso/request_test.go index 6887ee28124..4be50eaea68 100644 --- a/client/clients/tso/request_test.go +++ b/client/clients/tso/request_test.go @@ -18,8 +18,9 @@ import ( "context" "testing" - "github.com/pingcap/errors" "github.com/stretchr/testify/require" + + "github.com/pingcap/errors" ) func TestTsoRequestWait(t *testing.T) { diff --git a/client/clients/tso/stream.go b/client/clients/tso/stream.go index 6baf63c8882..291d1d31b65 100644 --- a/client/clients/tso/stream.go +++ b/client/clients/tso/stream.go @@ -23,17 +23,19 @@ import ( "sync/atomic" "time" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" + "google.golang.org/grpc" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus" + "github.com/tikv/pd/client/constants" "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/metrics" - "go.uber.org/zap" - "google.golang.org/grpc" ) // TSO Stream Builder Factory diff --git a/client/clients/tso/stream_test.go b/client/clients/tso/stream_test.go index 0244c06e024..4791b90bb81 100644 --- a/client/clients/tso/stream_test.go +++ b/client/clients/tso/stream_test.go @@ -21,12 +21,14 @@ import ( "testing" "time" - "github.com/pingcap/errors" - "github.com/pingcap/log" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "github.com/tikv/pd/client/errs" "go.uber.org/zap/zapcore" + + "github.com/pingcap/errors" + "github.com/pingcap/log" + + "github.com/tikv/pd/client/errs" ) const mockStreamURL = "mock:///" diff --git a/client/errs/errs.go b/client/errs/errs.go index 67a5dd8ec92..868faa6a77a 100644 --- a/client/errs/errs.go +++ b/client/errs/errs.go @@ -17,10 +17,11 @@ package errs import ( "strings" - "github.com/pingcap/errors" "go.uber.org/zap" "go.uber.org/zap/zapcore" "google.golang.org/grpc/codes" + + "github.com/pingcap/errors" ) // IsLeaderChange will determine whether there is a leader/primary change. diff --git a/client/gc_client.go b/client/gc_client.go index f30521905c3..45fc8b40b91 100644 --- a/client/gc_client.go +++ b/client/gc_client.go @@ -19,11 +19,13 @@ import ( "time" "github.com/opentracing/opentracing-go" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/metrics" - "go.uber.org/zap" ) // GCClient is a client for doing GC diff --git a/client/http/client.go b/client/http/client.go index c813474fcf6..fa9801cf764 100644 --- a/client/http/client.go +++ b/client/http/client.go @@ -23,13 +23,15 @@ import ( "net/http" "time" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus" + "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/pkg/retry" sd "github.com/tikv/pd/client/servicediscovery" - "go.uber.org/zap" ) const ( diff --git a/client/http/client_test.go b/client/http/client_test.go index a14691eed02..b6c2105bd4a 100644 --- a/client/http/client_test.go +++ b/client/http/client_test.go @@ -23,6 +23,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/pkg/retry" ) diff --git a/client/http/interface.go b/client/http/interface.go index 772599e27fb..1aabd1ae331 100644 --- a/client/http/interface.go +++ b/client/http/interface.go @@ -26,6 +26,7 @@ import ( "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/client/pkg/retry" ) diff --git a/client/http/request_info.go b/client/http/request_info.go index 1e3449b59a0..d1930800304 100644 --- a/client/http/request_info.go +++ b/client/http/request_info.go @@ -17,8 +17,9 @@ package http import ( "fmt" - "github.com/tikv/pd/client/pkg/retry" "go.uber.org/zap" + + "github.com/tikv/pd/client/pkg/retry" ) // The following constants are the names of the requests. diff --git a/client/http/types.go b/client/http/types.go index cab564e99ac..83e8badf334 100644 --- a/client/http/types.go +++ b/client/http/types.go @@ -22,6 +22,7 @@ import ( "github.com/pingcap/kvproto/pkg/encryptionpb" "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/kvproto/pkg/pdpb" + pd "github.com/tikv/pd/client/clients/router" ) diff --git a/client/inner_client.go b/client/inner_client.go index ae15c763854..045a9a6eed8 100644 --- a/client/inner_client.go +++ b/client/inner_client.go @@ -6,20 +6,21 @@ import ( "sync" "time" + "go.uber.org/zap" + "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + cb "github.com/tikv/pd/client/circuitbreaker" "github.com/tikv/pd/client/clients/tso" "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/metrics" "github.com/tikv/pd/client/opt" sd "github.com/tikv/pd/client/servicediscovery" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/status" ) const ( diff --git a/client/keyspace_client.go b/client/keyspace_client.go index ce0cc0bc426..84bc29054eb 100644 --- a/client/keyspace_client.go +++ b/client/keyspace_client.go @@ -19,8 +19,10 @@ import ( "time" "github.com/opentracing/opentracing-go" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/metrics" ) diff --git a/client/meta_storage_client.go b/client/meta_storage_client.go index 45bcb8d3d65..fbabd60debd 100644 --- a/client/meta_storage_client.go +++ b/client/meta_storage_client.go @@ -19,10 +19,12 @@ import ( "time" "github.com/opentracing/opentracing-go" + "github.com/prometheus/client_golang/prometheus" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/meta_storagepb" - "github.com/prometheus/client_golang/prometheus" + "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/metrics" "github.com/tikv/pd/client/opt" diff --git a/client/opt/option.go b/client/opt/option.go index 9a80a895cc0..c7a0bb17195 100644 --- a/client/opt/option.go +++ b/client/opt/option.go @@ -18,12 +18,13 @@ import ( "sync/atomic" "time" - cb "github.com/tikv/pd/client/circuitbreaker" + "github.com/prometheus/client_golang/prometheus" + "google.golang.org/grpc" "github.com/pingcap/errors" - "github.com/prometheus/client_golang/prometheus" + + cb "github.com/tikv/pd/client/circuitbreaker" "github.com/tikv/pd/client/pkg/retry" - "google.golang.org/grpc" ) const ( diff --git a/client/opt/option_test.go b/client/opt/option_test.go index 26760fac7f2..fa0decbb3a1 100644 --- a/client/opt/option_test.go +++ b/client/opt/option_test.go @@ -19,6 +19,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/client/pkg/utils/testutil" ) diff --git a/client/pkg/retry/backoff.go b/client/pkg/retry/backoff.go index b0524e6c139..e3b331582d6 100644 --- a/client/pkg/retry/backoff.go +++ b/client/pkg/retry/backoff.go @@ -21,10 +21,11 @@ import ( "strings" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" - "go.uber.org/zap" ) // Option is used to customize the backoffer. diff --git a/client/pkg/retry/backoff_test.go b/client/pkg/retry/backoff_test.go index 12891d822aa..b01a753b374 100644 --- a/client/pkg/retry/backoff_test.go +++ b/client/pkg/retry/backoff_test.go @@ -22,9 +22,10 @@ import ( "testing" "time" - "github.com/pingcap/log" "github.com/stretchr/testify/require" "go.uber.org/zap" + + "github.com/pingcap/log" ) func TestBackoffer(t *testing.T) { diff --git a/client/pkg/utils/grpcutil/grpcutil.go b/client/pkg/utils/grpcutil/grpcutil.go index 29967263dd3..b73d117fe84 100644 --- a/client/pkg/utils/grpcutil/grpcutil.go +++ b/client/pkg/utils/grpcutil/grpcutil.go @@ -21,17 +21,19 @@ import ( "sync" "time" - "github.com/pingcap/errors" - "github.com/pingcap/failpoint" - "github.com/pingcap/log" - "github.com/tikv/pd/client/errs" - "github.com/tikv/pd/client/pkg/retry" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" + + "github.com/pingcap/errors" + "github.com/pingcap/failpoint" + "github.com/pingcap/log" + + "github.com/tikv/pd/client/errs" + "github.com/tikv/pd/client/pkg/retry" ) const ( diff --git a/client/pkg/utils/testutil/check_env_linux.go b/client/pkg/utils/testutil/check_env_linux.go index df45f359eb3..ebe6a8e0663 100644 --- a/client/pkg/utils/testutil/check_env_linux.go +++ b/client/pkg/utils/testutil/check_env_linux.go @@ -18,8 +18,9 @@ package testutil import ( "github.com/cakturk/go-netstat/netstat" - "github.com/pingcap/log" "go.uber.org/zap" + + "github.com/pingcap/log" ) func environmentCheck(addr string) bool { diff --git a/client/pkg/utils/testutil/tempurl.go b/client/pkg/utils/testutil/tempurl.go index 71d51176106..d948160ba42 100644 --- a/client/pkg/utils/testutil/tempurl.go +++ b/client/pkg/utils/testutil/tempurl.go @@ -20,8 +20,9 @@ import ( "sync" "time" - "github.com/pingcap/log" "go.uber.org/zap" + + "github.com/pingcap/log" ) var ( diff --git a/client/pkg/utils/tlsutil/tlsconfig.go b/client/pkg/utils/tlsutil/tlsconfig.go index 88d797d3b3a..65e0ce9542f 100644 --- a/client/pkg/utils/tlsutil/tlsconfig.go +++ b/client/pkg/utils/tlsutil/tlsconfig.go @@ -40,6 +40,7 @@ import ( "fmt" "github.com/pingcap/errors" + "github.com/tikv/pd/client/errs" ) diff --git a/client/pkg/utils/tlsutil/url.go b/client/pkg/utils/tlsutil/url.go index ccc312d195b..abe4132a6a9 100644 --- a/client/pkg/utils/tlsutil/url.go +++ b/client/pkg/utils/tlsutil/url.go @@ -19,8 +19,9 @@ import ( "net/url" "strings" - "github.com/pingcap/log" "go.uber.org/zap" + + "github.com/pingcap/log" ) const ( diff --git a/client/resource_group/controller/controller.go b/client/resource_group/controller/controller.go index 46401aad1ff..2265053fdd2 100644 --- a/client/resource_group/controller/controller.go +++ b/client/resource_group/controller/controller.go @@ -24,18 +24,20 @@ import ( "time" "github.com/gogo/protobuf/proto" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" + "golang.org/x/exp/slices" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/meta_storagepb" rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/clients/metastorage" "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/opt" - "go.uber.org/zap" - "golang.org/x/exp/slices" ) const ( diff --git a/client/resource_group/controller/controller_test.go b/client/resource_group/controller/controller_test.go index 254df36020e..f0bdc62d6d3 100644 --- a/client/resource_group/controller/controller_test.go +++ b/client/resource_group/controller/controller_test.go @@ -24,11 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/meta_storagepb" rmpb "github.com/pingcap/kvproto/pkg/resource_manager" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/opt" diff --git a/client/resource_group/controller/limiter.go b/client/resource_group/controller/limiter.go index cd05adb7dfa..c8843da00bd 100644 --- a/client/resource_group/controller/limiter.go +++ b/client/resource_group/controller/limiter.go @@ -25,10 +25,12 @@ import ( "sync" "time" - "github.com/pingcap/log" "github.com/prometheus/client_golang/prometheus" - "github.com/tikv/pd/client/errs" "go.uber.org/zap" + + "github.com/pingcap/log" + + "github.com/tikv/pd/client/errs" ) // Limit defines the maximum frequency of some events. diff --git a/client/resource_group/controller/model_test.go b/client/resource_group/controller/model_test.go index 594091da364..99cac79c25a 100644 --- a/client/resource_group/controller/model_test.go +++ b/client/resource_group/controller/model_test.go @@ -17,8 +17,9 @@ package controller import ( "testing" - rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/stretchr/testify/require" + + rmpb "github.com/pingcap/kvproto/pkg/resource_manager" ) func TestGetRUValueFromConsumption(t *testing.T) { diff --git a/client/resource_manager_client.go b/client/resource_manager_client.go index 3cf2970109f..0c481631b93 100644 --- a/client/resource_manager_client.go +++ b/client/resource_manager_client.go @@ -19,14 +19,16 @@ import ( "time" "github.com/gogo/protobuf/proto" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/meta_storagepb" rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/pingcap/log" + "github.com/tikv/pd/client/constants" "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/opt" - "go.uber.org/zap" ) type actionType int diff --git a/client/servicediscovery/pd_service_discovery.go b/client/servicediscovery/pd_service_discovery.go index bd4e442030a..619d4196408 100644 --- a/client/servicediscovery/pd_service_discovery.go +++ b/client/servicediscovery/pd_service_discovery.go @@ -25,21 +25,23 @@ import ( "sync/atomic" "time" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + healthpb "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/status" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/client/constants" "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/opt" "github.com/tikv/pd/client/pkg/retry" "github.com/tikv/pd/client/pkg/utils/grpcutil" "github.com/tikv/pd/client/pkg/utils/tlsutil" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - healthpb "google.golang.org/grpc/health/grpc_health_v1" - "google.golang.org/grpc/status" ) const ( diff --git a/client/servicediscovery/pd_service_discovery_test.go b/client/servicediscovery/pd_service_discovery_test.go index e8e7ef14e44..dc0a0bd4511 100644 --- a/client/servicediscovery/pd_service_discovery_test.go +++ b/client/servicediscovery/pd_service_discovery_test.go @@ -25,21 +25,23 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/pdpb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "github.com/tikv/pd/client/errs" - "github.com/tikv/pd/client/opt" - "github.com/tikv/pd/client/pkg/utils/grpcutil" - "github.com/tikv/pd/client/pkg/utils/testutil" - "github.com/tikv/pd/client/pkg/utils/tlsutil" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" pb "google.golang.org/grpc/examples/helloworld/helloworld" "google.golang.org/grpc/health" healthpb "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/metadata" + + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/pdpb" + + "github.com/tikv/pd/client/errs" + "github.com/tikv/pd/client/opt" + "github.com/tikv/pd/client/pkg/utils/grpcutil" + "github.com/tikv/pd/client/pkg/utils/testutil" + "github.com/tikv/pd/client/pkg/utils/tlsutil" ) type testGRPCServer struct { diff --git a/client/servicediscovery/tso_service_discovery.go b/client/servicediscovery/tso_service_discovery.go index 3fd27837f95..1d2130db804 100644 --- a/client/servicediscovery/tso_service_discovery.go +++ b/client/servicediscovery/tso_service_discovery.go @@ -25,17 +25,19 @@ import ( "time" "github.com/gogo/protobuf/proto" + "go.uber.org/zap" + "google.golang.org/grpc" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" + "github.com/tikv/pd/client/clients/metastorage" "github.com/tikv/pd/client/constants" "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/opt" "github.com/tikv/pd/client/pkg/utils/grpcutil" - "go.uber.org/zap" - "google.golang.org/grpc" ) const ( diff --git a/cmd/pd-server/main.go b/cmd/pd-server/main.go index 0181d4c47aa..165bcd2a12f 100644 --- a/cmd/pd-server/main.go +++ b/cmd/pd-server/main.go @@ -22,8 +22,11 @@ import ( "syscall" grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - "github.com/pingcap/log" "github.com/spf13/cobra" + "go.uber.org/zap" + + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/autoscaling" "github.com/tikv/pd/pkg/dashboard" "github.com/tikv/pd/pkg/errs" @@ -41,7 +44,6 @@ import ( "github.com/tikv/pd/server/apiv2" "github.com/tikv/pd/server/config" "github.com/tikv/pd/server/join" - "go.uber.org/zap" // register microservice API _ "github.com/tikv/pd/pkg/mcs/resourcemanager/server/install" diff --git a/pkg/audit/audit.go b/pkg/audit/audit.go index f84d035f8c9..eba9722f44f 100644 --- a/pkg/audit/audit.go +++ b/pkg/audit/audit.go @@ -17,10 +17,12 @@ package audit import ( "net/http" - "github.com/pingcap/log" "github.com/prometheus/client_golang/prometheus" - "github.com/tikv/pd/pkg/utils/requestutil" "go.uber.org/zap" + + "github.com/pingcap/log" + + "github.com/tikv/pd/pkg/utils/requestutil" ) const ( diff --git a/pkg/audit/audit_test.go b/pkg/audit/audit_test.go index 9066d81ebe3..c210d91f8b2 100644 --- a/pkg/audit/audit_test.go +++ b/pkg/audit/audit_test.go @@ -27,6 +27,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/requestutil" "github.com/tikv/pd/pkg/utils/testutil" ) diff --git a/pkg/autoscaling/calculation.go b/pkg/autoscaling/calculation.go index 43aa2972ed8..41db5f6cf78 100644 --- a/pkg/autoscaling/calculation.go +++ b/pkg/autoscaling/calculation.go @@ -20,17 +20,19 @@ import ( "strings" "time" + promClient "github.com/prometheus/client_golang/api" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" - promClient "github.com/prometheus/client_golang/api" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/schedule/filter" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/server/cluster" "github.com/tikv/pd/server/config" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const ( diff --git a/pkg/autoscaling/calculation_test.go b/pkg/autoscaling/calculation_test.go index 9eb4ad648df..c2a70f8920e 100644 --- a/pkg/autoscaling/calculation_test.go +++ b/pkg/autoscaling/calculation_test.go @@ -23,6 +23,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/autoscaling/handler.go b/pkg/autoscaling/handler.go index ea248fdcc55..52b342f4a85 100644 --- a/pkg/autoscaling/handler.go +++ b/pkg/autoscaling/handler.go @@ -19,9 +19,10 @@ import ( "io" "net/http" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) // HTTPHandler is a handler to handle the auto scaling HTTP request. diff --git a/pkg/autoscaling/prometheus.go b/pkg/autoscaling/prometheus.go index 91b813b6ef2..43c47c8c898 100644 --- a/pkg/autoscaling/prometheus.go +++ b/pkg/autoscaling/prometheus.go @@ -22,13 +22,15 @@ import ( "strings" "time" - "github.com/pingcap/errors" - "github.com/pingcap/log" promClient "github.com/prometheus/client_golang/api" promAPI "github.com/prometheus/client_golang/api/prometheus/v1" promModel "github.com/prometheus/common/model" - "github.com/tikv/pd/pkg/errs" "go.uber.org/zap" + + "github.com/pingcap/errors" + "github.com/pingcap/log" + + "github.com/tikv/pd/pkg/errs" ) const ( diff --git a/pkg/autoscaling/service.go b/pkg/autoscaling/service.go index a8d84b2e598..304f1aa1188 100644 --- a/pkg/autoscaling/service.go +++ b/pkg/autoscaling/service.go @@ -18,11 +18,12 @@ import ( "context" "net/http" + "github.com/unrolled/render" + "github.com/urfave/negroni" + "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/apiutil/serverapi" "github.com/tikv/pd/server" - "github.com/unrolled/render" - "github.com/urfave/negroni" ) const autoScalingPrefix = "/autoscaling" diff --git a/pkg/autoscaling/types.go b/pkg/autoscaling/types.go index 53c614312b2..bee0d157191 100644 --- a/pkg/autoscaling/types.go +++ b/pkg/autoscaling/types.go @@ -20,8 +20,9 @@ import ( "regexp" "strings" - "github.com/tikv/pd/pkg/utils/etcdutil" clientv3 "go.etcd.io/etcd/client/v3" + + "github.com/tikv/pd/pkg/utils/etcdutil" ) // Strategy within a HTTP request provides rules and resources to help make decision for auto scaling. diff --git a/pkg/cache/cache_test.go b/pkg/cache/cache_test.go index 75f26cfed33..d7d7365a344 100644 --- a/pkg/cache/cache_test.go +++ b/pkg/cache/cache_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/testutil" ) diff --git a/pkg/cache/ttl.go b/pkg/cache/ttl.go index 2aa39f6c6fd..ba7e3b67330 100644 --- a/pkg/cache/ttl.go +++ b/pkg/cache/ttl.go @@ -18,10 +18,12 @@ import ( "context" "time" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) type ttlCacheItem struct { diff --git a/pkg/cgroup/cgmon.go b/pkg/cgroup/cgmon.go index 407e50f50c7..4be033facb1 100644 --- a/pkg/cgroup/cgmon.go +++ b/pkg/cgroup/cgmon.go @@ -21,10 +21,12 @@ import ( "sync" "time" - "github.com/pingcap/log" "github.com/shirou/gopsutil/v3/mem" - bs "github.com/tikv/pd/pkg/basicserver" "go.uber.org/zap" + + "github.com/pingcap/log" + + bs "github.com/tikv/pd/pkg/basicserver" ) const ( diff --git a/pkg/cgroup/cgroup.go b/pkg/cgroup/cgroup.go index 133bd3158c8..0093020a0ac 100644 --- a/pkg/cgroup/cgroup.go +++ b/pkg/cgroup/cgroup.go @@ -26,9 +26,10 @@ import ( "strconv" "strings" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" - "go.uber.org/zap" ) // CPUQuotaStatus presents the status of how CPU quota is used diff --git a/pkg/core/factory_test.go b/pkg/core/factory_test.go index 9f0ba883885..a81da9af081 100644 --- a/pkg/core/factory_test.go +++ b/pkg/core/factory_test.go @@ -18,7 +18,9 @@ import ( "testing" "github.com/gogo/protobuf/proto" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/utils/typeutil" ) diff --git a/pkg/core/region.go b/pkg/core/region.go index b5ead86b3f1..5f5a4a5f2e0 100644 --- a/pkg/core/region.go +++ b/pkg/core/region.go @@ -29,17 +29,19 @@ import ( "github.com/docker/go-units" "github.com/gogo/protobuf/proto" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/replication_modepb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/core/region_test.go b/pkg/core/region_test.go index 8c30efb2769..51ba5fe96dc 100644 --- a/pkg/core/region_test.go +++ b/pkg/core/region_test.go @@ -23,10 +23,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/id" "github.com/tikv/pd/pkg/mock/mockid" diff --git a/pkg/core/region_tree.go b/pkg/core/region_tree.go index 12e2c5c8878..6efafd133cf 100644 --- a/pkg/core/region_tree.go +++ b/pkg/core/region_tree.go @@ -18,12 +18,14 @@ import ( "bytes" "math/rand" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/btree" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/logutil" - "go.uber.org/zap" ) type regionItem struct { diff --git a/pkg/core/region_tree_test.go b/pkg/core/region_tree_test.go index 0dedd91be9e..4d18394aa70 100644 --- a/pkg/core/region_tree_test.go +++ b/pkg/core/region_tree_test.go @@ -19,9 +19,10 @@ import ( "math/rand" "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" ) func TestRegionInfo(t *testing.T) { diff --git a/pkg/core/store.go b/pkg/core/store.go index 5edf59f6dce..9ec9a44bfc8 100644 --- a/pkg/core/store.go +++ b/pkg/core/store.go @@ -20,15 +20,17 @@ import ( "time" "github.com/docker/go-units" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/core/store_option.go b/pkg/core/store_option.go index 3d05a0fb6e1..80fb09853e2 100644 --- a/pkg/core/store_option.go +++ b/pkg/core/store_option.go @@ -19,6 +19,7 @@ import ( "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/utils/typeutil" diff --git a/pkg/core/store_stats.go b/pkg/core/store_stats.go index d68f8b8e43c..6c6a6420d56 100644 --- a/pkg/core/store_stats.go +++ b/pkg/core/store_stats.go @@ -16,6 +16,7 @@ package core import ( "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/movingaverage" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/typeutil" diff --git a/pkg/core/store_stats_test.go b/pkg/core/store_stats_test.go index 9f2969cd81f..47f30dbd27b 100644 --- a/pkg/core/store_stats_test.go +++ b/pkg/core/store_stats_test.go @@ -18,9 +18,10 @@ import ( "testing" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" ) func TestStoreStats(t *testing.T) { diff --git a/pkg/core/store_test.go b/pkg/core/store_test.go index 5cb324e5635..7c5aaa98289 100644 --- a/pkg/core/store_test.go +++ b/pkg/core/store_test.go @@ -21,9 +21,11 @@ import ( "time" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/typeutil" ) diff --git a/pkg/core/storelimit/limit_test.go b/pkg/core/storelimit/limit_test.go index cfe805935a5..eb0bde2732f 100644 --- a/pkg/core/storelimit/limit_test.go +++ b/pkg/core/storelimit/limit_test.go @@ -23,6 +23,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core/constant" ) diff --git a/pkg/dashboard/adapter/manager.go b/pkg/dashboard/adapter/manager.go index 293d8ad6549..648f5562419 100644 --- a/pkg/dashboard/adapter/manager.go +++ b/pkg/dashboard/adapter/manager.go @@ -23,6 +23,7 @@ import ( "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" "github.com/pingcap/tidb-dashboard/pkg/apiserver" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/server" diff --git a/pkg/dashboard/adapter/redirector.go b/pkg/dashboard/adapter/redirector.go index c1d845065b7..5d0fd1801cd 100644 --- a/pkg/dashboard/adapter/redirector.go +++ b/pkg/dashboard/adapter/redirector.go @@ -22,6 +22,7 @@ import ( "github.com/pingcap/tidb-dashboard/pkg/apiserver" "github.com/pingcap/tidb-dashboard/pkg/utils" + "github.com/tikv/pd/pkg/utils/syncutil" ) diff --git a/pkg/dashboard/distroutil/distro.go b/pkg/dashboard/distroutil/distro.go index a19db806d70..0bc7b1d031b 100644 --- a/pkg/dashboard/distroutil/distro.go +++ b/pkg/dashboard/distroutil/distro.go @@ -18,9 +18,10 @@ import ( "os" "path/filepath" + "go.uber.org/zap" + "github.com/pingcap/log" "github.com/pingcap/tidb-dashboard/util/distro" - "go.uber.org/zap" ) const ( diff --git a/pkg/dashboard/keyvisual/input/core.go b/pkg/dashboard/keyvisual/input/core.go index 3ca5f96cd81..0219d6e0b77 100644 --- a/pkg/dashboard/keyvisual/input/core.go +++ b/pkg/dashboard/keyvisual/input/core.go @@ -15,11 +15,13 @@ package input import ( + "go.uber.org/zap" + "github.com/pingcap/log" regionpkg "github.com/pingcap/tidb-dashboard/pkg/keyvisual/region" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/server" - "go.uber.org/zap" ) const limit = 1024 diff --git a/pkg/dashboard/uiserver/embedded_assets_rewriter.go b/pkg/dashboard/uiserver/embedded_assets_rewriter.go index d19db01936f..f0f9f0c1e51 100644 --- a/pkg/dashboard/uiserver/embedded_assets_rewriter.go +++ b/pkg/dashboard/uiserver/embedded_assets_rewriter.go @@ -22,6 +22,7 @@ import ( "github.com/pingcap/tidb-dashboard/pkg/config" "github.com/pingcap/tidb-dashboard/pkg/uiserver" + "github.com/tikv/pd/pkg/dashboard/distroutil" ) diff --git a/pkg/election/leadership.go b/pkg/election/leadership.go index ec64a003c53..bb0ce7bf361 100644 --- a/pkg/election/leadership.go +++ b/pkg/election/leadership.go @@ -19,18 +19,20 @@ 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/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/pkg/utils/syncutil" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const ( diff --git a/pkg/election/leadership_test.go b/pkg/election/leadership_test.go index eab842ca6e5..fc158e6f73a 100644 --- a/pkg/election/leadership_test.go +++ b/pkg/election/leadership_test.go @@ -21,12 +21,14 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/utils/etcdutil" - "github.com/tikv/pd/pkg/utils/testutil" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/server/v3/embed" + + "github.com/pingcap/failpoint" + + "github.com/tikv/pd/pkg/utils/etcdutil" + "github.com/tikv/pd/pkg/utils/testutil" ) const defaultLeaseTimeout = 1 diff --git a/pkg/election/lease.go b/pkg/election/lease.go index 21bd43018b5..1dff5ea7a99 100644 --- a/pkg/election/lease.go +++ b/pkg/election/lease.go @@ -19,13 +19,15 @@ import ( "sync/atomic" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/typeutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const ( diff --git a/pkg/election/lease_test.go b/pkg/election/lease_test.go index 3a02de97239..b099d0c0d5e 100644 --- a/pkg/election/lease_test.go +++ b/pkg/election/lease_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/etcdutil" ) diff --git a/pkg/encryption/config.go b/pkg/encryption/config.go index d4d257a8a43..38222c56b5d 100644 --- a/pkg/encryption/config.go +++ b/pkg/encryption/config.go @@ -18,6 +18,7 @@ import ( "time" "github.com/pingcap/kvproto/pkg/encryptionpb" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/typeutil" ) diff --git a/pkg/encryption/config_test.go b/pkg/encryption/config_test.go index 4134d46c2f3..2ab5ae68dfa 100644 --- a/pkg/encryption/config_test.go +++ b/pkg/encryption/config_test.go @@ -19,6 +19,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/typeutil" ) diff --git a/pkg/encryption/crypter.go b/pkg/encryption/crypter.go index 7e69854c5a8..5c91228c150 100644 --- a/pkg/encryption/crypter.go +++ b/pkg/encryption/crypter.go @@ -22,6 +22,7 @@ import ( "io" "github.com/pingcap/kvproto/pkg/encryptionpb" + "github.com/tikv/pd/pkg/errs" ) diff --git a/pkg/encryption/crypter_test.go b/pkg/encryption/crypter_test.go index 9ac72bd7813..ff660cc1a9d 100644 --- a/pkg/encryption/crypter_test.go +++ b/pkg/encryption/crypter_test.go @@ -19,8 +19,9 @@ import ( "encoding/hex" "testing" - "github.com/pingcap/kvproto/pkg/encryptionpb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/encryptionpb" ) func TestEncryptionMethodSupported(t *testing.T) { diff --git a/pkg/encryption/key_manager.go b/pkg/encryption/key_manager.go index 621b1b9742f..54e5fa01b35 100644 --- a/pkg/encryption/key_manager.go +++ b/pkg/encryption/key_manager.go @@ -20,15 +20,17 @@ import ( "time" "github.com/gogo/protobuf/proto" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/encryptionpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/election" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/syncutil" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const ( diff --git a/pkg/encryption/key_manager_test.go b/pkg/encryption/key_manager_test.go index f387497c2e9..52e91296314 100644 --- a/pkg/encryption/key_manager_test.go +++ b/pkg/encryption/key_manager_test.go @@ -24,13 +24,15 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/pingcap/kvproto/pkg/encryptionpb" "github.com/stretchr/testify/require" + clientv3 "go.etcd.io/etcd/client/v3" + + "github.com/pingcap/kvproto/pkg/encryptionpb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/election" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/typeutil" - clientv3 "go.etcd.io/etcd/client/v3" ) // #nosec G101 diff --git a/pkg/encryption/kms.go b/pkg/encryption/kms.go index 99dcf9619a3..3836cf53db6 100644 --- a/pkg/encryption/kms.go +++ b/pkg/encryption/kms.go @@ -22,7 +22,9 @@ import ( "github.com/aws/aws-sdk-go-v2/credentials/stscreds" "github.com/aws/aws-sdk-go-v2/service/kms" "github.com/aws/aws-sdk-go-v2/service/sts" + "github.com/pingcap/kvproto/pkg/encryptionpb" + "github.com/tikv/pd/pkg/errs" ) diff --git a/pkg/encryption/master_key.go b/pkg/encryption/master_key.go index 31d9a0cb591..aff480386ac 100644 --- a/pkg/encryption/master_key.go +++ b/pkg/encryption/master_key.go @@ -20,6 +20,7 @@ import ( "strings" "github.com/pingcap/kvproto/pkg/encryptionpb" + "github.com/tikv/pd/pkg/errs" ) diff --git a/pkg/encryption/master_key_test.go b/pkg/encryption/master_key_test.go index d6d7845284a..0a8e99bf75a 100644 --- a/pkg/encryption/master_key_test.go +++ b/pkg/encryption/master_key_test.go @@ -20,8 +20,9 @@ import ( "path/filepath" "testing" - "github.com/pingcap/kvproto/pkg/encryptionpb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/encryptionpb" ) func TestPlaintextMasterKey(t *testing.T) { diff --git a/pkg/encryption/region_crypter.go b/pkg/encryption/region_crypter.go index 458c5b67d7b..96826d8bef6 100644 --- a/pkg/encryption/region_crypter.go +++ b/pkg/encryption/region_crypter.go @@ -22,6 +22,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/encryptionpb" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/typeutil" diff --git a/pkg/encryption/region_crypter_test.go b/pkg/encryption/region_crypter_test.go index b1ca558063c..1b6f910b0d5 100644 --- a/pkg/encryption/region_crypter_test.go +++ b/pkg/encryption/region_crypter_test.go @@ -19,10 +19,11 @@ import ( "crypto/cipher" "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/encryptionpb" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/stretchr/testify/require" ) type testKeyManager struct { diff --git a/pkg/errs/errs.go b/pkg/errs/errs.go index 5746b282f10..84cc90312d1 100644 --- a/pkg/errs/errs.go +++ b/pkg/errs/errs.go @@ -15,9 +15,10 @@ package errs import ( - "github.com/pingcap/errors" "go.uber.org/zap" "go.uber.org/zap/zapcore" + + "github.com/pingcap/errors" ) // ZapError is used to make the log output easier. diff --git a/pkg/errs/errs_test.go b/pkg/errs/errs_test.go index 01b7de461b8..80722f4a8c4 100644 --- a/pkg/errs/errs_test.go +++ b/pkg/errs/errs_test.go @@ -20,10 +20,11 @@ import ( "strings" "testing" - "github.com/pingcap/errors" - "github.com/pingcap/log" "github.com/stretchr/testify/require" "go.uber.org/zap" + + "github.com/pingcap/errors" + "github.com/pingcap/log" ) // testingWriter is a WriteSyncer that writes to the the messages. diff --git a/pkg/gc/safepoint.go b/pkg/gc/safepoint.go index c1b4687e109..5bc64ae9a90 100644 --- a/pkg/gc/safepoint.go +++ b/pkg/gc/safepoint.go @@ -19,6 +19,7 @@ import ( "time" "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/server/config" diff --git a/pkg/gc/safepoint_test.go b/pkg/gc/safepoint_test.go index 62ce9c086fc..b67f7b4fe44 100644 --- a/pkg/gc/safepoint_test.go +++ b/pkg/gc/safepoint_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/server/config" diff --git a/pkg/gc/safepoint_v2.go b/pkg/gc/safepoint_v2.go index 665249bcab0..449be8f3d59 100644 --- a/pkg/gc/safepoint_v2.go +++ b/pkg/gc/safepoint_v2.go @@ -18,16 +18,18 @@ import ( "context" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/keyspace" "github.com/tikv/pd/pkg/slice" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) var ( diff --git a/pkg/gctuner/memory_limit_tuner.go b/pkg/gctuner/memory_limit_tuner.go index 8a852b191d8..10e28842938 100644 --- a/pkg/gctuner/memory_limit_tuner.go +++ b/pkg/gctuner/memory_limit_tuner.go @@ -20,12 +20,14 @@ import ( "sync/atomic" "time" + "go.uber.org/zap" + "github.com/pingcap/failpoint" "github.com/pingcap/log" + util "github.com/tikv/pd/pkg/gogc" "github.com/tikv/pd/pkg/memory" "github.com/tikv/pd/pkg/utils/logutil" - "go.uber.org/zap" ) // GlobalMemoryLimitTuner only allow one memory limit tuner in one process diff --git a/pkg/gctuner/memory_limit_tuner_test.go b/pkg/gctuner/memory_limit_tuner_test.go index 5e5f84ccbac..6c0aaca685d 100644 --- a/pkg/gctuner/memory_limit_tuner_test.go +++ b/pkg/gctuner/memory_limit_tuner_test.go @@ -20,8 +20,10 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/memory" ) diff --git a/pkg/gctuner/tuner.go b/pkg/gctuner/tuner.go index 74932fe174b..bc63b36c5a2 100644 --- a/pkg/gctuner/tuner.go +++ b/pkg/gctuner/tuner.go @@ -20,9 +20,11 @@ import ( "strconv" "sync/atomic" + "go.uber.org/zap" + "github.com/pingcap/log" + util "github.com/tikv/pd/pkg/gogc" - "go.uber.org/zap" ) var ( diff --git a/pkg/id/id.go b/pkg/id/id.go index eb2788fc656..cb38c23268d 100644 --- a/pkg/id/id.go +++ b/pkg/id/id.go @@ -15,16 +15,18 @@ package id import ( - "github.com/pingcap/log" "github.com/prometheus/client_golang/prometheus" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/typeutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) type label string diff --git a/pkg/id/id_test.go b/pkg/id/id_test.go index e08c0e93367..9cd8493c430 100644 --- a/pkg/id/id_test.go +++ b/pkg/id/id_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/etcdutil" ) diff --git a/pkg/keyspace/keyspace.go b/pkg/keyspace/keyspace.go index 08bb51da936..4a50f36169f 100644 --- a/pkg/keyspace/keyspace.go +++ b/pkg/keyspace/keyspace.go @@ -20,10 +20,13 @@ import ( "strconv" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/id" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/schedule/core" @@ -35,7 +38,6 @@ import ( "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/keyspace/keyspace_test.go b/pkg/keyspace/keyspace_test.go index 3c259649cd3..57aeb70341d 100644 --- a/pkg/keyspace/keyspace_test.go +++ b/pkg/keyspace/keyspace_test.go @@ -23,10 +23,12 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/mock/mockid" "github.com/tikv/pd/pkg/storage/endpoint" diff --git a/pkg/keyspace/tso_keyspace_group.go b/pkg/keyspace/tso_keyspace_group.go index fa26b4cd0cb..dc414cfad3a 100644 --- a/pkg/keyspace/tso_keyspace_group.go +++ b/pkg/keyspace/tso_keyspace_group.go @@ -23,10 +23,15 @@ import ( "sync" "time" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/balancer" "github.com/tikv/pd/pkg/mcs/discovery" "github.com/tikv/pd/pkg/mcs/utils/constant" @@ -38,9 +43,6 @@ import ( "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const ( diff --git a/pkg/keyspace/tso_keyspace_group_test.go b/pkg/keyspace/tso_keyspace_group_test.go index 5878d7d907f..c615627be71 100644 --- a/pkg/keyspace/tso_keyspace_group_test.go +++ b/pkg/keyspace/tso_keyspace_group_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/keyspace/util.go b/pkg/keyspace/util.go index 91d07676205..95b3162eed0 100644 --- a/pkg/keyspace/util.go +++ b/pkg/keyspace/util.go @@ -23,6 +23,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/pkg/codec" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/schedule/labeler" diff --git a/pkg/keyspace/util_test.go b/pkg/keyspace/util_test.go index ab544b21a5d..f938904c709 100644 --- a/pkg/keyspace/util_test.go +++ b/pkg/keyspace/util_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/codec" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/schedule/labeler" diff --git a/pkg/mcs/discovery/discover.go b/pkg/mcs/discovery/discover.go index d4234df893d..f46c72495c6 100644 --- a/pkg/mcs/discovery/discover.go +++ b/pkg/mcs/discovery/discover.go @@ -15,15 +15,17 @@ package discovery import ( + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // Discover is used to get all the service instances of the specified service name. diff --git a/pkg/mcs/discovery/discover_test.go b/pkg/mcs/discovery/discover_test.go index fd66ddcad18..81af0d524b7 100644 --- a/pkg/mcs/discovery/discover_test.go +++ b/pkg/mcs/discovery/discover_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/etcdutil" ) diff --git a/pkg/mcs/discovery/register.go b/pkg/mcs/discovery/register.go index 5ab0ceabfce..e62239a4694 100644 --- a/pkg/mcs/discovery/register.go +++ b/pkg/mcs/discovery/register.go @@ -19,12 +19,14 @@ import ( "fmt" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/logutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // DefaultLeaseInSeconds is the default lease time in seconds. diff --git a/pkg/mcs/discovery/register_test.go b/pkg/mcs/discovery/register_test.go index bdaf7e379a4..b03543f624e 100644 --- a/pkg/mcs/discovery/register_test.go +++ b/pkg/mcs/discovery/register_test.go @@ -22,10 +22,11 @@ import ( "time" "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/utils/etcdutil" - "github.com/tikv/pd/pkg/utils/testutil" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/server/v3/embed" + + "github.com/tikv/pd/pkg/utils/etcdutil" + "github.com/tikv/pd/pkg/utils/testutil" ) func TestRegister(t *testing.T) { diff --git a/pkg/mcs/discovery/registry_entry.go b/pkg/mcs/discovery/registry_entry.go index db4ac44a2cc..887a8eb7aea 100644 --- a/pkg/mcs/discovery/registry_entry.go +++ b/pkg/mcs/discovery/registry_entry.go @@ -17,8 +17,9 @@ package discovery import ( "encoding/json" - "github.com/pingcap/log" "go.uber.org/zap" + + "github.com/pingcap/log" ) // ServiceRegistryEntry is the registry entry of a service diff --git a/pkg/mcs/metastorage/server/grpc_service.go b/pkg/mcs/metastorage/server/grpc_service.go index 32b3788906d..00f4efb56fd 100644 --- a/pkg/mcs/metastorage/server/grpc_service.go +++ b/pkg/mcs/metastorage/server/grpc_service.go @@ -19,17 +19,19 @@ import ( "fmt" "net/http" + 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/kvproto/pkg/meta_storagepb" "github.com/pingcap/log" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/mcs/registry" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/keypath" - 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/pkg/mcs/metastorage/server/manager.go b/pkg/mcs/metastorage/server/manager.go index 49fc58c6b7d..0c03e4c7d03 100644 --- a/pkg/mcs/metastorage/server/manager.go +++ b/pkg/mcs/metastorage/server/manager.go @@ -15,12 +15,14 @@ package server import ( + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/log" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/storage/kv" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // Manager is the manager of resource group. diff --git a/pkg/mcs/registry/registry.go b/pkg/mcs/registry/registry.go index c6470b34dc4..6a01f091e52 100644 --- a/pkg/mcs/registry/registry.go +++ b/pkg/mcs/registry/registry.go @@ -20,10 +20,12 @@ import ( "fmt" "net/http" - "github.com/pingcap/log" - bs "github.com/tikv/pd/pkg/basicserver" "go.uber.org/zap" "google.golang.org/grpc" + + "github.com/pingcap/log" + + bs "github.com/tikv/pd/pkg/basicserver" ) var ( diff --git a/pkg/mcs/resourcemanager/server/apis/v1/api.go b/pkg/mcs/resourcemanager/server/apis/v1/api.go index 891072e898f..e142dbbc69a 100644 --- a/pkg/mcs/resourcemanager/server/apis/v1/api.go +++ b/pkg/mcs/resourcemanager/server/apis/v1/api.go @@ -25,7 +25,9 @@ import ( "github.com/gin-contrib/gzip" "github.com/gin-contrib/pprof" "github.com/gin-gonic/gin" + rmpb "github.com/pingcap/kvproto/pkg/resource_manager" + rmserver "github.com/tikv/pd/pkg/mcs/resourcemanager/server" "github.com/tikv/pd/pkg/mcs/utils" "github.com/tikv/pd/pkg/utils/apiutil" diff --git a/pkg/mcs/resourcemanager/server/config.go b/pkg/mcs/resourcemanager/server/config.go index 360f3b169b9..415a87d5e79 100644 --- a/pkg/mcs/resourcemanager/server/config.go +++ b/pkg/mcs/resourcemanager/server/config.go @@ -22,16 +22,18 @@ import ( "time" "github.com/BurntSushi/toml" + "github.com/spf13/pflag" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" - "github.com/spf13/pflag" + "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/configutil" "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/pkg/utils/metricutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/mcs/resourcemanager/server/grpc_service.go b/pkg/mcs/resourcemanager/server/grpc_service.go index 21681bc0759..6c0d7ce0120 100644 --- a/pkg/mcs/resourcemanager/server/grpc_service.go +++ b/pkg/mcs/resourcemanager/server/grpc_service.go @@ -20,17 +20,19 @@ import ( "net/http" "time" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/pingcap/log" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/mcs/registry" "github.com/tikv/pd/pkg/utils/apiutil" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) var ( diff --git a/pkg/mcs/resourcemanager/server/manager.go b/pkg/mcs/resourcemanager/server/manager.go index 7f7e710b3fb..2ccfd44c418 100644 --- a/pkg/mcs/resourcemanager/server/manager.go +++ b/pkg/mcs/resourcemanager/server/manager.go @@ -23,11 +23,14 @@ import ( "time" "github.com/gogo/protobuf/proto" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/endpoint" @@ -35,7 +38,6 @@ import ( "github.com/tikv/pd/pkg/utils/jsonutil" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/mcs/resourcemanager/server/metrics_test.go b/pkg/mcs/resourcemanager/server/metrics_test.go index d69d364b64b..4c3ec7ce5ef 100644 --- a/pkg/mcs/resourcemanager/server/metrics_test.go +++ b/pkg/mcs/resourcemanager/server/metrics_test.go @@ -18,8 +18,9 @@ import ( "fmt" "testing" - rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/stretchr/testify/require" + + rmpb "github.com/pingcap/kvproto/pkg/resource_manager" ) func TestMaxPerSecCostTracker(t *testing.T) { diff --git a/pkg/mcs/resourcemanager/server/resource_group.go b/pkg/mcs/resourcemanager/server/resource_group.go index 6a5d06da6f7..65d2959e870 100644 --- a/pkg/mcs/resourcemanager/server/resource_group.go +++ b/pkg/mcs/resourcemanager/server/resource_group.go @@ -20,12 +20,14 @@ import ( "time" "github.com/gogo/protobuf/proto" + "go.uber.org/zap" + "github.com/pingcap/errors" rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) // ResourceGroup is the definition of a resource group, for REST API. diff --git a/pkg/mcs/resourcemanager/server/resource_group_test.go b/pkg/mcs/resourcemanager/server/resource_group_test.go index 96b15d14293..8f058a212bb 100644 --- a/pkg/mcs/resourcemanager/server/resource_group_test.go +++ b/pkg/mcs/resourcemanager/server/resource_group_test.go @@ -5,8 +5,9 @@ import ( "testing" "github.com/brianvoe/gofakeit/v6" - rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/stretchr/testify/require" + + rmpb "github.com/pingcap/kvproto/pkg/resource_manager" ) func TestPatchResourceGroup(t *testing.T) { diff --git a/pkg/mcs/resourcemanager/server/token_buckets.go b/pkg/mcs/resourcemanager/server/token_buckets.go index f72d0dfcc88..50dc78c9d68 100644 --- a/pkg/mcs/resourcemanager/server/token_buckets.go +++ b/pkg/mcs/resourcemanager/server/token_buckets.go @@ -19,9 +19,10 @@ import ( "time" "github.com/gogo/protobuf/proto" + "go.uber.org/zap" + rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/pingcap/log" - "go.uber.org/zap" ) const ( diff --git a/pkg/mcs/resourcemanager/server/token_buckets_test.go b/pkg/mcs/resourcemanager/server/token_buckets_test.go index 3d9cbd3f628..b56ccb6ab96 100644 --- a/pkg/mcs/resourcemanager/server/token_buckets_test.go +++ b/pkg/mcs/resourcemanager/server/token_buckets_test.go @@ -20,8 +20,9 @@ import ( "testing" "time" - rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/stretchr/testify/require" + + rmpb "github.com/pingcap/kvproto/pkg/resource_manager" ) func TestGroupTokenBucketUpdateAndPatch(t *testing.T) { diff --git a/pkg/mcs/scheduling/server/apis/v1/api.go b/pkg/mcs/scheduling/server/apis/v1/api.go index c374456a6eb..3d2d0005a24 100644 --- a/pkg/mcs/scheduling/server/apis/v1/api.go +++ b/pkg/mcs/scheduling/server/apis/v1/api.go @@ -27,8 +27,11 @@ import ( "github.com/gin-contrib/gzip" "github.com/gin-contrib/pprof" "github.com/gin-gonic/gin" + "github.com/unrolled/render" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" scheserver "github.com/tikv/pd/pkg/mcs/scheduling/server" mcsutils "github.com/tikv/pd/pkg/mcs/utils" @@ -44,7 +47,6 @@ import ( "github.com/tikv/pd/pkg/utils/apiutil/multiservicesapi" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/typeutil" - "github.com/unrolled/render" ) // APIPathPrefix is the prefix of the API path. diff --git a/pkg/mcs/scheduling/server/cluster.go b/pkg/mcs/scheduling/server/cluster.go index e4949446da9..20e5acca379 100644 --- a/pkg/mcs/scheduling/server/cluster.go +++ b/pkg/mcs/scheduling/server/cluster.go @@ -7,12 +7,15 @@ import ( "sync/atomic" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/schedulingpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/cluster" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" @@ -35,7 +38,6 @@ import ( "github.com/tikv/pd/pkg/storage" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/logutil" - "go.uber.org/zap" ) // Cluster is used to manage all information for scheduling purpose. diff --git a/pkg/mcs/scheduling/server/config/config.go b/pkg/mcs/scheduling/server/config/config.go index 45a606720a0..784d1f45a82 100644 --- a/pkg/mcs/scheduling/server/config/config.go +++ b/pkg/mcs/scheduling/server/config/config.go @@ -27,10 +27,13 @@ import ( "github.com/BurntSushi/toml" "github.com/coreos/go-semver/semver" + "github.com/spf13/pflag" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" - "github.com/spf13/pflag" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/core/storelimit" @@ -43,7 +46,6 @@ import ( "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/pkg/utils/metricutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/mcs/scheduling/server/config/watcher.go b/pkg/mcs/scheduling/server/config/watcher.go index f0af61c9dd2..f499a0d7d50 100644 --- a/pkg/mcs/scheduling/server/config/watcher.go +++ b/pkg/mcs/scheduling/server/config/watcher.go @@ -23,15 +23,17 @@ import ( "time" "github.com/coreos/go-semver/semver" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/log" + sc "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/schedule/schedulers" "github.com/tikv/pd/pkg/storage" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // Watcher is used to watch the PD API server for any configuration changes. diff --git a/pkg/mcs/scheduling/server/grpc_service.go b/pkg/mcs/scheduling/server/grpc_service.go index f4fe606b403..440b2d47d4f 100644 --- a/pkg/mcs/scheduling/server/grpc_service.go +++ b/pkg/mcs/scheduling/server/grpc_service.go @@ -21,10 +21,16 @@ import ( "sync/atomic" "time" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/schedulingpb" "github.com/pingcap/log" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" @@ -33,10 +39,6 @@ import ( "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/versioninfo" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) // gRPC errors diff --git a/pkg/mcs/scheduling/server/meta/watcher.go b/pkg/mcs/scheduling/server/meta/watcher.go index 9d54a636b9e..27fe6687f3d 100644 --- a/pkg/mcs/scheduling/server/meta/watcher.go +++ b/pkg/mcs/scheduling/server/meta/watcher.go @@ -20,15 +20,17 @@ import ( "sync" "github.com/gogo/protobuf/proto" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/statistics" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // Watcher is used to watch the PD API server for any meta changes. diff --git a/pkg/mcs/scheduling/server/rule/watcher.go b/pkg/mcs/scheduling/server/rule/watcher.go index 790dd9c2f81..cc6480a0cb4 100644 --- a/pkg/mcs/scheduling/server/rule/watcher.go +++ b/pkg/mcs/scheduling/server/rule/watcher.go @@ -19,7 +19,12 @@ import ( "strings" "sync" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/checker" "github.com/tikv/pd/pkg/schedule/labeler" @@ -27,9 +32,6 @@ import ( "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // Watcher is used to watch the PD API server for any Placement Rule changes. diff --git a/pkg/mcs/scheduling/server/rule/watcher_test.go b/pkg/mcs/scheduling/server/rule/watcher_test.go index 40469eef2a8..5b3d49a53f1 100644 --- a/pkg/mcs/scheduling/server/rule/watcher_test.go +++ b/pkg/mcs/scheduling/server/rule/watcher_test.go @@ -24,14 +24,15 @@ import ( "time" "github.com/stretchr/testify/require" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/embed" + "github.com/tikv/pd/pkg/keyspace" "github.com/tikv/pd/pkg/schedule/labeler" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/embed" ) const ( diff --git a/pkg/mcs/scheduling/server/server.go b/pkg/mcs/scheduling/server/server.go index 31c8d307adb..8c9972d5eec 100644 --- a/pkg/mcs/scheduling/server/server.go +++ b/pkg/mcs/scheduling/server/server.go @@ -28,6 +28,10 @@ import ( "time" grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus" + "github.com/spf13/cobra" + "go.uber.org/zap" + "google.golang.org/grpc" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/diagnosticspb" @@ -35,7 +39,7 @@ import ( "github.com/pingcap/kvproto/pkg/schedulingpb" "github.com/pingcap/log" "github.com/pingcap/sysutil" - "github.com/spf13/cobra" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core" @@ -62,8 +66,6 @@ import ( "github.com/tikv/pd/pkg/utils/memberutil" "github.com/tikv/pd/pkg/utils/metricutil" "github.com/tikv/pd/pkg/versioninfo" - "go.uber.org/zap" - "google.golang.org/grpc" ) var _ bs.Server = (*Server)(nil) diff --git a/pkg/mcs/scheduling/server/testutil.go b/pkg/mcs/scheduling/server/testutil.go index 312365c81ab..794a1bf520c 100644 --- a/pkg/mcs/scheduling/server/testutil.go +++ b/pkg/mcs/scheduling/server/testutil.go @@ -18,9 +18,11 @@ import ( "context" "os" - "github.com/pingcap/log" "github.com/spf13/pflag" "github.com/stretchr/testify/require" + + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/mcs/scheduling/server/config" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/testutil" diff --git a/pkg/mcs/server/server.go b/pkg/mcs/server/server.go index fef05a85012..9692b52beb3 100644 --- a/pkg/mcs/server/server.go +++ b/pkg/mcs/server/server.go @@ -23,11 +23,13 @@ import ( "sync" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "google.golang.org/grpc" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/grpcutil" - clientv3 "go.etcd.io/etcd/client/v3" - "google.golang.org/grpc" ) // BaseServer is a basic server that provides some common functionality. diff --git a/pkg/mcs/tso/server/apis/v1/api.go b/pkg/mcs/tso/server/apis/v1/api.go index ec8782eb522..d659c13edca 100644 --- a/pkg/mcs/tso/server/apis/v1/api.go +++ b/pkg/mcs/tso/server/apis/v1/api.go @@ -23,8 +23,12 @@ import ( "github.com/gin-contrib/gzip" "github.com/gin-contrib/pprof" "github.com/gin-gonic/gin" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" tsoserver "github.com/tikv/pd/pkg/mcs/tso/server" "github.com/tikv/pd/pkg/mcs/utils" @@ -34,8 +38,6 @@ import ( "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/apiutil/multiservicesapi" "github.com/tikv/pd/pkg/utils/logutil" - "github.com/unrolled/render" - "go.uber.org/zap" ) const ( diff --git a/pkg/mcs/tso/server/config.go b/pkg/mcs/tso/server/config.go index 2aaa54114da..f2ee3c36a7b 100644 --- a/pkg/mcs/tso/server/config.go +++ b/pkg/mcs/tso/server/config.go @@ -22,16 +22,18 @@ import ( "time" "github.com/BurntSushi/toml" + "github.com/spf13/pflag" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/spf13/pflag" + "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/tso" "github.com/tikv/pd/pkg/utils/configutil" "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/pkg/utils/metricutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/mcs/tso/server/config_test.go b/pkg/mcs/tso/server/config_test.go index 2bafec30aa9..08686bd5208 100644 --- a/pkg/mcs/tso/server/config_test.go +++ b/pkg/mcs/tso/server/config_test.go @@ -21,6 +21,7 @@ import ( "github.com/BurntSushi/toml" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/mcs/utils/constant" ) diff --git a/pkg/mcs/tso/server/grpc_service.go b/pkg/mcs/tso/server/grpc_service.go index 3419fd16221..59abed67213 100644 --- a/pkg/mcs/tso/server/grpc_service.go +++ b/pkg/mcs/tso/server/grpc_service.go @@ -21,16 +21,18 @@ import ( "strconv" "time" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/mcs/registry" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/keypath" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) // gRPC errors diff --git a/pkg/mcs/tso/server/server.go b/pkg/mcs/tso/server/server.go index d2974075e94..34f51573baf 100644 --- a/pkg/mcs/tso/server/server.go +++ b/pkg/mcs/tso/server/server.go @@ -27,12 +27,18 @@ import ( "time" grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus" + "github.com/spf13/cobra" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/diagnosticspb" "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" "github.com/pingcap/sysutil" - "github.com/spf13/cobra" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/discovery" @@ -49,10 +55,6 @@ import ( "github.com/tikv/pd/pkg/utils/metricutil" "github.com/tikv/pd/pkg/utils/tsoutil" "github.com/tikv/pd/pkg/versioninfo" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) var _ bs.Server = (*Server)(nil) diff --git a/pkg/mcs/tso/server/testutil.go b/pkg/mcs/tso/server/testutil.go index 5dcfd4759b9..5ffcac48edb 100644 --- a/pkg/mcs/tso/server/testutil.go +++ b/pkg/mcs/tso/server/testutil.go @@ -17,11 +17,12 @@ package server import ( "strings" - "github.com/pingcap/kvproto/pkg/tsopb" "github.com/spf13/pflag" "github.com/stretchr/testify/require" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + + "github.com/pingcap/kvproto/pkg/tsopb" ) // MustNewGrpcClient must create a new TSO grpc client. diff --git a/pkg/mcs/utils/expected_primary.go b/pkg/mcs/utils/expected_primary.go index c39345b004e..b8a317ed251 100644 --- a/pkg/mcs/utils/expected_primary.go +++ b/pkg/mcs/utils/expected_primary.go @@ -20,8 +20,12 @@ import ( "math/rand" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/election" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/discovery" @@ -29,8 +33,6 @@ import ( "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // GetExpectedPrimaryFlag gets the expected primary flag. diff --git a/pkg/mcs/utils/util.go b/pkg/mcs/utils/util.go index 253c846d167..68e7edb3d69 100644 --- a/pkg/mcs/utils/util.go +++ b/pkg/mcs/utils/util.go @@ -25,11 +25,18 @@ import ( "time" "github.com/gin-gonic/gin" - "github.com/pingcap/kvproto/pkg/diagnosticspb" - "github.com/pingcap/log" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/soheilhy/cmux" + etcdtypes "go.etcd.io/etcd/client/pkg/v3/types" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/keepalive" + + "github.com/pingcap/kvproto/pkg/diagnosticspb" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/discovery" "github.com/tikv/pd/pkg/mcs/utils/constant" @@ -40,11 +47,6 @@ import ( "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/versioninfo" - etcdtypes "go.etcd.io/etcd/client/pkg/v3/types" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/keepalive" ) // PromHandler is a handler to get prometheus metrics. diff --git a/pkg/member/member.go b/pkg/member/member.go index 04e55c1a647..8b388cdee6a 100644 --- a/pkg/member/member.go +++ b/pkg/member/member.go @@ -24,18 +24,20 @@ import ( "sync/atomic" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/embed" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/election" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/embed" - "go.uber.org/zap" ) const ( diff --git a/pkg/member/participant.go b/pkg/member/participant.go index f3399f5d900..5d9129bcad5 100644 --- a/pkg/member/participant.go +++ b/pkg/member/participant.go @@ -19,16 +19,18 @@ import ( "sync/atomic" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/schedulingpb" "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/election" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) type leadershipCheckFunc func(*election.Leadership) bool diff --git a/pkg/memory/meminfo.go b/pkg/memory/meminfo.go index 64505e2e5f3..7ed1afb579b 100644 --- a/pkg/memory/meminfo.go +++ b/pkg/memory/meminfo.go @@ -17,14 +17,16 @@ package memory import ( "time" + "github.com/shirou/gopsutil/v3/mem" + "go.uber.org/zap" + "golang.org/x/exp/constraints" + "github.com/pingcap/failpoint" "github.com/pingcap/log" "github.com/pingcap/sysutil" - "github.com/shirou/gopsutil/v3/mem" + "github.com/tikv/pd/pkg/cgroup" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" - "golang.org/x/exp/constraints" ) // MemTotal returns the total amount of RAM on this system diff --git a/pkg/mock/mockcluster/mockcluster.go b/pkg/mock/mockcluster/mockcluster.go index 5fe17e5e723..45d8e35a0bc 100644 --- a/pkg/mock/mockcluster/mockcluster.go +++ b/pkg/mock/mockcluster/mockcluster.go @@ -21,10 +21,12 @@ import ( "time" "github.com/docker/go-units" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/core/storelimit" diff --git a/pkg/mock/mockhbstream/mockhbstream.go b/pkg/mock/mockhbstream/mockhbstream.go index ac8f246f86a..848f134c8a0 100644 --- a/pkg/mock/mockhbstream/mockhbstream.go +++ b/pkg/mock/mockhbstream/mockhbstream.go @@ -19,6 +19,7 @@ import ( "time" "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/hbstream" ) diff --git a/pkg/mock/mockhbstream/mockhbstream_test.go b/pkg/mock/mockhbstream/mockhbstream_test.go index 87a39b028b9..e4ffe8a9b20 100644 --- a/pkg/mock/mockhbstream/mockhbstream_test.go +++ b/pkg/mock/mockhbstream/mockhbstream_test.go @@ -18,10 +18,12 @@ import ( "context" "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/eraftpb" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" "github.com/tikv/pd/pkg/schedule/hbstream" diff --git a/pkg/mock/mockserver/mockserver.go b/pkg/mock/mockserver/mockserver.go index d79d79ffa03..3ba2abfca3f 100644 --- a/pkg/mock/mockserver/mockserver.go +++ b/pkg/mock/mockserver/mockserver.go @@ -18,6 +18,7 @@ import ( "context" "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/storage" "github.com/tikv/pd/pkg/utils/grpcutil" diff --git a/pkg/ratelimit/controller_test.go b/pkg/ratelimit/controller_test.go index 5efa6ec1190..f42169c9902 100644 --- a/pkg/ratelimit/controller_test.go +++ b/pkg/ratelimit/controller_test.go @@ -21,8 +21,9 @@ import ( "time" "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/utils/syncutil" "golang.org/x/time/rate" + + "github.com/tikv/pd/pkg/utils/syncutil" ) type changeAndResult struct { diff --git a/pkg/ratelimit/limiter.go b/pkg/ratelimit/limiter.go index e312066dc56..0fc3a4e6bd1 100644 --- a/pkg/ratelimit/limiter.go +++ b/pkg/ratelimit/limiter.go @@ -17,9 +17,10 @@ package ratelimit import ( "math" + "golang.org/x/time/rate" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/syncutil" - "golang.org/x/time/rate" ) // DoneFunc is done function. diff --git a/pkg/ratelimit/limiter_test.go b/pkg/ratelimit/limiter_test.go index 256f9ea9ab4..2bb967677bb 100644 --- a/pkg/ratelimit/limiter_test.go +++ b/pkg/ratelimit/limiter_test.go @@ -20,8 +20,9 @@ import ( "time" "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/utils/syncutil" "golang.org/x/time/rate" + + "github.com/tikv/pd/pkg/utils/syncutil" ) type releaseUtil struct { diff --git a/pkg/ratelimit/ratelimiter.go b/pkg/ratelimit/ratelimiter.go index b88127915c9..1c2a6a0f7b0 100644 --- a/pkg/ratelimit/ratelimiter.go +++ b/pkg/ratelimit/ratelimiter.go @@ -18,8 +18,9 @@ import ( "context" "time" - "github.com/tikv/pd/pkg/utils/syncutil" "golang.org/x/time/rate" + + "github.com/tikv/pd/pkg/utils/syncutil" ) // RateLimiter is a rate limiter based on `golang.org/x/time/rate`. diff --git a/pkg/ratelimit/runner.go b/pkg/ratelimit/runner.go index 1d65ff6a568..211a4f71be1 100644 --- a/pkg/ratelimit/runner.go +++ b/pkg/ratelimit/runner.go @@ -20,9 +20,10 @@ import ( "sync" "time" - "github.com/pingcap/log" "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" + + "github.com/pingcap/log" ) // RegionHeartbeatStageName is the name of the stage of the region heartbeat. diff --git a/pkg/replication/replication_mode.go b/pkg/replication/replication_mode.go index cba83cf1ebb..856a68a9b09 100644 --- a/pkg/replication/replication_mode.go +++ b/pkg/replication/replication_mode.go @@ -24,9 +24,12 @@ import ( "sync" "time" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/pdpb" pb "github.com/pingcap/kvproto/pkg/replication_modepb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" sche "github.com/tikv/pd/pkg/schedule/core" @@ -35,7 +38,6 @@ import ( "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/server/config" - "go.uber.org/zap" ) const ( diff --git a/pkg/replication/replication_mode_test.go b/pkg/replication/replication_mode_test.go index 243d7f7d8f1..0a921bccf3a 100644 --- a/pkg/replication/replication_mode_test.go +++ b/pkg/replication/replication_mode_test.go @@ -22,9 +22,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/pdpb" pb "github.com/pingcap/kvproto/pkg/replication_modepb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/response/region.go b/pkg/response/region.go index 6db7f135ad8..b635780e4f2 100644 --- a/pkg/response/region.go +++ b/pkg/response/region.go @@ -18,9 +18,11 @@ import ( "context" "github.com/mailru/easyjson/jwriter" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/replication_modepb" + "github.com/tikv/pd/pkg/core" ) diff --git a/pkg/response/region_test.go b/pkg/response/region_test.go index de6daa2c2fe..8da4c739f79 100644 --- a/pkg/response/region_test.go +++ b/pkg/response/region_test.go @@ -18,9 +18,10 @@ import ( "encoding/json" "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" ) func TestPeer(t *testing.T) { diff --git a/pkg/response/store.go b/pkg/response/store.go index 8bff1e75e42..25dc7fc2176 100644 --- a/pkg/response/store.go +++ b/pkg/response/store.go @@ -18,6 +18,7 @@ import ( "time" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" sc "github.com/tikv/pd/pkg/schedule/config" diff --git a/pkg/schedule/checker/checker_controller.go b/pkg/schedule/checker/checker_controller.go index 49d097daea6..aa15ee03d6f 100644 --- a/pkg/schedule/checker/checker_controller.go +++ b/pkg/schedule/checker/checker_controller.go @@ -22,8 +22,11 @@ import ( "sync/atomic" "time" + "go.uber.org/zap" + "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" @@ -34,7 +37,6 @@ import ( "github.com/tikv/pd/pkg/schedule/placement" "github.com/tikv/pd/pkg/utils/keyutil" "github.com/tikv/pd/pkg/utils/logutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/checker/joint_state_checker.go b/pkg/schedule/checker/joint_state_checker.go index 2122044e64a..4dc3922906a 100644 --- a/pkg/schedule/checker/joint_state_checker.go +++ b/pkg/schedule/checker/joint_state_checker.go @@ -16,6 +16,7 @@ package checker import ( "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" diff --git a/pkg/schedule/checker/joint_state_checker_test.go b/pkg/schedule/checker/joint_state_checker_test.go index 1b9436b65fd..f649c737284 100644 --- a/pkg/schedule/checker/joint_state_checker_test.go +++ b/pkg/schedule/checker/joint_state_checker_test.go @@ -18,8 +18,10 @@ import ( "context" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/schedule/checker/learner_checker.go b/pkg/schedule/checker/learner_checker.go index 8590904a760..6d830c39ad8 100644 --- a/pkg/schedule/checker/learner_checker.go +++ b/pkg/schedule/checker/learner_checker.go @@ -16,6 +16,7 @@ package checker import ( "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" sche "github.com/tikv/pd/pkg/schedule/core" diff --git a/pkg/schedule/checker/learner_checker_test.go b/pkg/schedule/checker/learner_checker_test.go index b5d994d4201..3a559b86958 100644 --- a/pkg/schedule/checker/learner_checker_test.go +++ b/pkg/schedule/checker/learner_checker_test.go @@ -18,8 +18,10 @@ import ( "context" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/schedule/checker/merge_checker.go b/pkg/schedule/checker/merge_checker.go index bf7fe4f2496..571ee134da0 100644 --- a/pkg/schedule/checker/merge_checker.go +++ b/pkg/schedule/checker/merge_checker.go @@ -20,6 +20,7 @@ import ( "time" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/codec" "github.com/tikv/pd/pkg/core" diff --git a/pkg/schedule/checker/merge_checker_test.go b/pkg/schedule/checker/merge_checker_test.go index 00aaafa2cfd..3737e6cc0c2 100644 --- a/pkg/schedule/checker/merge_checker_test.go +++ b/pkg/schedule/checker/merge_checker_test.go @@ -20,8 +20,11 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/suite" + "go.uber.org/goleak" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/mock/mockcluster" @@ -34,7 +37,6 @@ import ( "github.com/tikv/pd/pkg/utils/operatorutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/versioninfo" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/pkg/schedule/checker/priority_inspector_test.go b/pkg/schedule/checker/priority_inspector_test.go index 5a5d8079d93..6de76b5ccb1 100644 --- a/pkg/schedule/checker/priority_inspector_test.go +++ b/pkg/schedule/checker/priority_inspector_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" ) diff --git a/pkg/schedule/checker/replica_checker.go b/pkg/schedule/checker/replica_checker.go index fabee683c92..f1d6efe15ba 100644 --- a/pkg/schedule/checker/replica_checker.go +++ b/pkg/schedule/checker/replica_checker.go @@ -19,8 +19,11 @@ import ( "math/rand" "time" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" @@ -29,7 +32,6 @@ import ( sche "github.com/tikv/pd/pkg/schedule/core" "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/schedule/types" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/checker/replica_checker_test.go b/pkg/schedule/checker/replica_checker_test.go index da04fb6d768..3f0f6b67d8d 100644 --- a/pkg/schedule/checker/replica_checker_test.go +++ b/pkg/schedule/checker/replica_checker_test.go @@ -20,10 +20,12 @@ import ( "time" "github.com/docker/go-units" - "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/kvproto/pkg/pdpb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" diff --git a/pkg/schedule/checker/replica_strategy.go b/pkg/schedule/checker/replica_strategy.go index ffb25f90ad5..3bf2c955af7 100644 --- a/pkg/schedule/checker/replica_strategy.go +++ b/pkg/schedule/checker/replica_strategy.go @@ -17,12 +17,14 @@ package checker import ( "math/rand" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" sche "github.com/tikv/pd/pkg/schedule/core" "github.com/tikv/pd/pkg/schedule/filter" - "go.uber.org/zap" ) // ReplicaStrategy collects some utilities to manipulate region peers. It diff --git a/pkg/schedule/checker/rule_checker.go b/pkg/schedule/checker/rule_checker.go index 2d06f84fdfe..28d5988ce1c 100644 --- a/pkg/schedule/checker/rule_checker.go +++ b/pkg/schedule/checker/rule_checker.go @@ -21,9 +21,12 @@ import ( "math/rand" "time" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" @@ -35,7 +38,6 @@ import ( "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/versioninfo" - "go.uber.org/zap" ) const maxPendingListLen = 100000 diff --git a/pkg/schedule/checker/rule_checker_test.go b/pkg/schedule/checker/rule_checker_test.go index 5ac67122de1..0b37ed57e7e 100644 --- a/pkg/schedule/checker/rule_checker_test.go +++ b/pkg/schedule/checker/rule_checker_test.go @@ -17,16 +17,17 @@ package checker import ( "context" "fmt" - "strconv" "strings" "testing" "time" + "github.com/stretchr/testify/suite" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" diff --git a/pkg/schedule/checker/split_checker.go b/pkg/schedule/checker/split_checker.go index 3cc1664b6cc..91487949821 100644 --- a/pkg/schedule/checker/split_checker.go +++ b/pkg/schedule/checker/split_checker.go @@ -17,6 +17,7 @@ package checker import ( "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" sche "github.com/tikv/pd/pkg/schedule/core" diff --git a/pkg/schedule/checker/split_checker_test.go b/pkg/schedule/checker/split_checker_test.go index 40357d2408c..be3cce84f0d 100644 --- a/pkg/schedule/checker/split_checker_test.go +++ b/pkg/schedule/checker/split_checker_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" "github.com/tikv/pd/pkg/schedule/labeler" diff --git a/pkg/schedule/config/config.go b/pkg/schedule/config/config.go index 5e8f2c587ac..f00cd8a943b 100644 --- a/pkg/schedule/config/config.go +++ b/pkg/schedule/config/config.go @@ -19,6 +19,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/utils/configutil" diff --git a/pkg/schedule/config/config_provider.go b/pkg/schedule/config/config_provider.go index 5c1be1089e9..a18051ca38e 100644 --- a/pkg/schedule/config/config_provider.go +++ b/pkg/schedule/config/config_provider.go @@ -19,7 +19,9 @@ import ( "time" "github.com/coreos/go-semver/semver" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/schedule/types" diff --git a/pkg/schedule/config/store_config.go b/pkg/schedule/config/store_config.go index b7676311f3d..19cca753d1d 100644 --- a/pkg/schedule/config/store_config.go +++ b/pkg/schedule/config/store_config.go @@ -18,10 +18,12 @@ import ( "encoding/json" "reflect" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) var ( diff --git a/pkg/schedule/config/util_test.go b/pkg/schedule/config/util_test.go index 31ab3ccf2a6..bda6b9441ad 100644 --- a/pkg/schedule/config/util_test.go +++ b/pkg/schedule/config/util_test.go @@ -17,8 +17,9 @@ package config import ( "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" ) func TestValidateLabels(t *testing.T) { diff --git a/pkg/schedule/coordinator.go b/pkg/schedule/coordinator.go index 739ca5c84b6..e792560cb37 100644 --- a/pkg/schedule/coordinator.go +++ b/pkg/schedule/coordinator.go @@ -20,9 +20,12 @@ import ( "sync" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/schedule/checker" @@ -39,7 +42,6 @@ import ( "github.com/tikv/pd/pkg/statistics/utils" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/filter/candidates_test.go b/pkg/schedule/filter/candidates_test.go index fd03b42ace0..ce8be5ef72e 100644 --- a/pkg/schedule/filter/candidates_test.go +++ b/pkg/schedule/filter/candidates_test.go @@ -19,8 +19,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/schedule/plan" diff --git a/pkg/schedule/filter/counter_test.go b/pkg/schedule/filter/counter_test.go index 7c7acc5e9a5..74ff194c47a 100644 --- a/pkg/schedule/filter/counter_test.go +++ b/pkg/schedule/filter/counter_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/schedule/types" ) diff --git a/pkg/schedule/filter/filters.go b/pkg/schedule/filter/filters.go index 4ea59935109..efb27c3ec6d 100644 --- a/pkg/schedule/filter/filters.go +++ b/pkg/schedule/filter/filters.go @@ -17,8 +17,11 @@ package filter import ( "strconv" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/core/storelimit" @@ -27,7 +30,6 @@ import ( "github.com/tikv/pd/pkg/schedule/plan" "github.com/tikv/pd/pkg/slice" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) // SelectSourceStores selects stores that be selected as source store from the list. diff --git a/pkg/schedule/filter/filters_test.go b/pkg/schedule/filter/filters_test.go index f061a472d65..35ba2c33589 100644 --- a/pkg/schedule/filter/filters_test.go +++ b/pkg/schedule/filter/filters_test.go @@ -19,9 +19,11 @@ import ( "time" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/core/storelimit" diff --git a/pkg/schedule/filter/healthy_test.go b/pkg/schedule/filter/healthy_test.go index 15588352554..dd5ab8e958d 100644 --- a/pkg/schedule/filter/healthy_test.go +++ b/pkg/schedule/filter/healthy_test.go @@ -18,9 +18,11 @@ import ( "context" "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/schedule/filter/region_filters_test.go b/pkg/schedule/filter/region_filters_test.go index a7dd1fa932a..ddd4141f8ba 100644 --- a/pkg/schedule/filter/region_filters_test.go +++ b/pkg/schedule/filter/region_filters_test.go @@ -19,9 +19,11 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/schedule/handler/handler.go b/pkg/schedule/handler/handler.go index a8540b4b5f4..042adf96611 100644 --- a/pkg/schedule/handler/handler.go +++ b/pkg/schedule/handler/handler.go @@ -23,11 +23,14 @@ import ( "strings" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/schedule" @@ -43,7 +46,6 @@ import ( "github.com/tikv/pd/pkg/statistics/buckets" "github.com/tikv/pd/pkg/statistics/utils" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/hbstream/heartbeat_streams.go b/pkg/schedule/hbstream/heartbeat_streams.go index ef0440a9f77..6637800e97f 100644 --- a/pkg/schedule/hbstream/heartbeat_streams.go +++ b/pkg/schedule/hbstream/heartbeat_streams.go @@ -20,17 +20,19 @@ import ( "sync" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/schedulingpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/logutil" - "go.uber.org/zap" ) // Operation is detailed scheduling step of a region. diff --git a/pkg/schedule/labeler/labeler.go b/pkg/schedule/labeler/labeler.go index 7670ccdedd7..16a14068e68 100644 --- a/pkg/schedule/labeler/labeler.go +++ b/pkg/schedule/labeler/labeler.go @@ -19,7 +19,10 @@ import ( "strings" "time" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/schedule/rangelist" @@ -27,7 +30,6 @@ import ( "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) // RegionLabeler is utility to label regions. diff --git a/pkg/schedule/labeler/labeler_test.go b/pkg/schedule/labeler/labeler_test.go index ebd57708e47..564542727ff 100644 --- a/pkg/schedule/labeler/labeler_test.go +++ b/pkg/schedule/labeler/labeler_test.go @@ -24,8 +24,10 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/storage" "github.com/tikv/pd/pkg/storage/endpoint" diff --git a/pkg/schedule/labeler/rules.go b/pkg/schedule/labeler/rules.go index 39a420032d8..4f5d28a8034 100644 --- a/pkg/schedule/labeler/rules.go +++ b/pkg/schedule/labeler/rules.go @@ -23,10 +23,12 @@ import ( "strings" "time" + "go.uber.org/zap" + "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" - "go.uber.org/zap" ) // RegionLabel is the label of a region. diff --git a/pkg/schedule/operator/builder.go b/pkg/schedule/operator/builder.go index 29b8aedf978..8fd2393da2e 100644 --- a/pkg/schedule/operator/builder.go +++ b/pkg/schedule/operator/builder.go @@ -20,6 +20,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sche "github.com/tikv/pd/pkg/schedule/core" "github.com/tikv/pd/pkg/schedule/filter" diff --git a/pkg/schedule/operator/builder_test.go b/pkg/schedule/operator/builder_test.go index 5e9ff7f89bb..77224a82c15 100644 --- a/pkg/schedule/operator/builder_test.go +++ b/pkg/schedule/operator/builder_test.go @@ -18,9 +18,11 @@ import ( "context" "testing" + "github.com/stretchr/testify/suite" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/schedule/operator/create_operator.go b/pkg/schedule/operator/create_operator.go index 4fae7f9e3f2..2558ca8d75b 100644 --- a/pkg/schedule/operator/create_operator.go +++ b/pkg/schedule/operator/create_operator.go @@ -18,16 +18,18 @@ import ( "fmt" "math/rand" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" sche "github.com/tikv/pd/pkg/schedule/core" "github.com/tikv/pd/pkg/schedule/placement" "github.com/tikv/pd/pkg/utils/logutil" - "go.uber.org/zap" ) // CreateAddPeerOperator creates an operator that adds a new peer. diff --git a/pkg/schedule/operator/create_operator_test.go b/pkg/schedule/operator/create_operator_test.go index 845255e713c..0143b1b8011 100644 --- a/pkg/schedule/operator/create_operator_test.go +++ b/pkg/schedule/operator/create_operator_test.go @@ -19,11 +19,13 @@ import ( "encoding/hex" "testing" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/schedule/operator/metrics.go b/pkg/schedule/operator/metrics.go index 47a165500e9..25de41f0fb7 100644 --- a/pkg/schedule/operator/metrics.go +++ b/pkg/schedule/operator/metrics.go @@ -16,6 +16,7 @@ package operator import ( "github.com/prometheus/client_golang/prometheus" + "github.com/tikv/pd/pkg/schedule/types" ) diff --git a/pkg/schedule/operator/operator.go b/pkg/schedule/operator/operator.go index 8abeae54f6b..69b2504755e 100644 --- a/pkg/schedule/operator/operator.go +++ b/pkg/schedule/operator/operator.go @@ -22,8 +22,10 @@ import ( "sync/atomic" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/prometheus/client_golang/prometheus" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" ) diff --git a/pkg/schedule/operator/operator_controller.go b/pkg/schedule/operator/operator_controller.go index 0478ef2b6ae..cd2470376e1 100644 --- a/pkg/schedule/operator/operator_controller.go +++ b/pkg/schedule/operator/operator_controller.go @@ -21,9 +21,12 @@ import ( "sync" "time" + "go.uber.org/zap" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" @@ -33,7 +36,6 @@ import ( "github.com/tikv/pd/pkg/schedule/hbstream" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/versioninfo" - "go.uber.org/zap" ) // The source of dispatched region. diff --git a/pkg/schedule/operator/operator_controller_test.go b/pkg/schedule/operator/operator_controller_test.go index 69600f80536..3c9abe54f24 100644 --- a/pkg/schedule/operator/operator_controller_test.go +++ b/pkg/schedule/operator/operator_controller_test.go @@ -22,11 +22,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/mock/mockcluster" diff --git a/pkg/schedule/operator/operator_test.go b/pkg/schedule/operator/operator_test.go index 22a86c789fc..6976b5ca12e 100644 --- a/pkg/schedule/operator/operator_test.go +++ b/pkg/schedule/operator/operator_test.go @@ -22,9 +22,11 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/core/storelimit" diff --git a/pkg/schedule/operator/step.go b/pkg/schedule/operator/step.go index 04e41028865..6b0f0f1021f 100644 --- a/pkg/schedule/operator/step.go +++ b/pkg/schedule/operator/step.go @@ -20,17 +20,19 @@ import ( "strings" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/eraftpb" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/schedule/hbstream" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/operator/step_test.go b/pkg/schedule/operator/step_test.go index 014703d00f9..f6323a6d23c 100644 --- a/pkg/schedule/operator/step_test.go +++ b/pkg/schedule/operator/step_test.go @@ -18,9 +18,11 @@ import ( "context" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/schedule/operator/test_util.go b/pkg/schedule/operator/test_util.go index 8206189daa6..f86701792dd 100644 --- a/pkg/schedule/operator/test_util.go +++ b/pkg/schedule/operator/test_util.go @@ -16,6 +16,7 @@ package operator import ( "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" ) diff --git a/pkg/schedule/operator/waiting_operator_test.go b/pkg/schedule/operator/waiting_operator_test.go index 8a0d1875cd7..a2e333231b0 100644 --- a/pkg/schedule/operator/waiting_operator_test.go +++ b/pkg/schedule/operator/waiting_operator_test.go @@ -17,8 +17,10 @@ package operator import ( "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core/constant" ) diff --git a/pkg/schedule/placement/fit.go b/pkg/schedule/placement/fit.go index 30530462664..bb1d642900b 100644 --- a/pkg/schedule/placement/fit.go +++ b/pkg/schedule/placement/fit.go @@ -20,6 +20,7 @@ import ( "sort" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" ) diff --git a/pkg/schedule/placement/fit_region_test.go b/pkg/schedule/placement/fit_region_test.go index 284674b79a2..9c6e7b7faf1 100644 --- a/pkg/schedule/placement/fit_region_test.go +++ b/pkg/schedule/placement/fit_region_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" ) diff --git a/pkg/schedule/placement/fit_test.go b/pkg/schedule/placement/fit_test.go index b12bcd7451a..f22661ba694 100644 --- a/pkg/schedule/placement/fit_test.go +++ b/pkg/schedule/placement/fit_test.go @@ -21,9 +21,11 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" ) diff --git a/pkg/schedule/placement/label_constraint_test.go b/pkg/schedule/placement/label_constraint_test.go index e65676f0a5e..cd2ff5976df 100644 --- a/pkg/schedule/placement/label_constraint_test.go +++ b/pkg/schedule/placement/label_constraint_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" ) diff --git a/pkg/schedule/placement/region_rule_cache.go b/pkg/schedule/placement/region_rule_cache.go index 79e52a49fca..4b17c3baf70 100644 --- a/pkg/schedule/placement/region_rule_cache.go +++ b/pkg/schedule/placement/region_rule_cache.go @@ -16,6 +16,7 @@ package placement import ( "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/slice" "github.com/tikv/pd/pkg/utils/syncutil" diff --git a/pkg/schedule/placement/region_rule_cache_test.go b/pkg/schedule/placement/region_rule_cache_test.go index e951ea10cc5..c526a095e7b 100644 --- a/pkg/schedule/placement/region_rule_cache_test.go +++ b/pkg/schedule/placement/region_rule_cache_test.go @@ -19,9 +19,11 @@ import ( "time" "unsafe" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" ) diff --git a/pkg/schedule/placement/rule_list.go b/pkg/schedule/placement/rule_list.go index f5ee0dada0e..3fc401163d1 100644 --- a/pkg/schedule/placement/rule_list.go +++ b/pkg/schedule/placement/rule_list.go @@ -20,6 +20,7 @@ import ( "strings" "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/schedule/rangelist" ) diff --git a/pkg/schedule/placement/rule_manager.go b/pkg/schedule/placement/rule_manager.go index f44258d797c..f5101f0250c 100644 --- a/pkg/schedule/placement/rule_manager.go +++ b/pkg/schedule/placement/rule_manager.go @@ -24,8 +24,12 @@ import ( "sort" "strings" + "go.uber.org/zap" + "golang.org/x/exp/slices" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/codec" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" @@ -35,8 +39,6 @@ import ( "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" - "golang.org/x/exp/slices" ) const ( diff --git a/pkg/schedule/placement/rule_manager_test.go b/pkg/schedule/placement/rule_manager_test.go index 2e1883640d8..5f5f457da13 100644 --- a/pkg/schedule/placement/rule_manager_test.go +++ b/pkg/schedule/placement/rule_manager_test.go @@ -19,8 +19,10 @@ import ( "encoding/hex" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/codec" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" diff --git a/pkg/schedule/plan/balance_plan_test.go b/pkg/schedule/plan/balance_plan_test.go index 59f2acc689a..8bdc2519a90 100644 --- a/pkg/schedule/plan/balance_plan_test.go +++ b/pkg/schedule/plan/balance_plan_test.go @@ -18,8 +18,10 @@ import ( "context" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" ) diff --git a/pkg/schedule/plugin_interface.go b/pkg/schedule/plugin_interface.go index 62ffe2eb900..8870ca7f46d 100644 --- a/pkg/schedule/plugin_interface.go +++ b/pkg/schedule/plugin_interface.go @@ -18,10 +18,12 @@ import ( "path/filepath" "plugin" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) // PluginInterface is used to manage all plugin. diff --git a/pkg/schedule/prepare_checker.go b/pkg/schedule/prepare_checker.go index 187d68e3d9f..5f6b54f33ae 100644 --- a/pkg/schedule/prepare_checker.go +++ b/pkg/schedule/prepare_checker.go @@ -17,10 +17,12 @@ package schedule import ( "time" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) type prepareChecker struct { diff --git a/pkg/schedule/scatter/region_scatterer.go b/pkg/schedule/scatter/region_scatterer.go index 71b2cd346c7..fdcbd705398 100644 --- a/pkg/schedule/scatter/region_scatterer.go +++ b/pkg/schedule/scatter/region_scatterer.go @@ -22,10 +22,13 @@ import ( "sync" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" @@ -36,7 +39,6 @@ import ( "github.com/tikv/pd/pkg/schedule/placement" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) const regionScatterName = "region-scatter" diff --git a/pkg/schedule/scatter/region_scatterer_test.go b/pkg/schedule/scatter/region_scatterer_test.go index fdaed888309..b86d73d4288 100644 --- a/pkg/schedule/scatter/region_scatterer_test.go +++ b/pkg/schedule/scatter/region_scatterer_test.go @@ -23,9 +23,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/mock/mockcluster" diff --git a/pkg/schedule/schedulers/balance_benchmark_test.go b/pkg/schedule/schedulers/balance_benchmark_test.go index aaafa7be8ca..abf4c0b3def 100644 --- a/pkg/schedule/schedulers/balance_benchmark_test.go +++ b/pkg/schedule/schedulers/balance_benchmark_test.go @@ -18,8 +18,10 @@ import ( "fmt" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/assert" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" "github.com/tikv/pd/pkg/schedule/operator" diff --git a/pkg/schedule/schedulers/balance_leader.go b/pkg/schedule/schedulers/balance_leader.go index 03f02002c74..2884e8a486f 100644 --- a/pkg/schedule/schedulers/balance_leader.go +++ b/pkg/schedule/schedulers/balance_leader.go @@ -23,7 +23,11 @@ import ( "strconv" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" @@ -34,8 +38,6 @@ import ( "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/utils/reflectutil" "github.com/tikv/pd/pkg/utils/typeutil" - "github.com/unrolled/render" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/schedulers/balance_leader_test.go b/pkg/schedule/schedulers/balance_leader_test.go index 940f75f78bc..36a4ee52ea6 100644 --- a/pkg/schedule/schedulers/balance_leader_test.go +++ b/pkg/schedule/schedulers/balance_leader_test.go @@ -22,9 +22,11 @@ import ( "testing" "github.com/docker/go-units" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/mock/mockcluster" diff --git a/pkg/schedule/schedulers/balance_region.go b/pkg/schedule/schedulers/balance_region.go index 2bee521364d..6ad95201f68 100644 --- a/pkg/schedule/schedulers/balance_region.go +++ b/pkg/schedule/schedulers/balance_region.go @@ -18,8 +18,11 @@ import ( "sort" "strconv" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" sche "github.com/tikv/pd/pkg/schedule/core" @@ -27,7 +30,6 @@ import ( "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/schedule/plan" "github.com/tikv/pd/pkg/schedule/types" - "go.uber.org/zap" ) type balanceRegionSchedulerConfig struct { diff --git a/pkg/schedule/schedulers/balance_region_test.go b/pkg/schedule/schedulers/balance_region_test.go index 48a4959a170..aa8e7fc30d1 100644 --- a/pkg/schedule/schedulers/balance_region_test.go +++ b/pkg/schedule/schedulers/balance_region_test.go @@ -18,8 +18,10 @@ import ( "fmt" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/mock/mockcluster" diff --git a/pkg/schedule/schedulers/balance_witness.go b/pkg/schedule/schedulers/balance_witness.go index cfcafb56c57..1b23e5b4a19 100644 --- a/pkg/schedule/schedulers/balance_witness.go +++ b/pkg/schedule/schedulers/balance_witness.go @@ -23,8 +23,12 @@ import ( "strconv" "github.com/gorilla/mux" - "github.com/pingcap/log" "github.com/prometheus/client_golang/prometheus" + "github.com/unrolled/render" + "go.uber.org/zap" + + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" @@ -35,8 +39,6 @@ import ( "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/utils/reflectutil" "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/unrolled/render" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/schedulers/balance_witness_test.go b/pkg/schedule/schedulers/balance_witness_test.go index b1449821236..a7edbd3ea94 100644 --- a/pkg/schedule/schedulers/balance_witness_test.go +++ b/pkg/schedule/schedulers/balance_witness_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/schedule/operator" diff --git a/pkg/schedule/schedulers/base_scheduler.go b/pkg/schedule/schedulers/base_scheduler.go index ef5c6bf7ae7..2534ed12281 100644 --- a/pkg/schedule/schedulers/base_scheduler.go +++ b/pkg/schedule/schedulers/base_scheduler.go @@ -21,6 +21,7 @@ import ( "time" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" sche "github.com/tikv/pd/pkg/schedule/core" "github.com/tikv/pd/pkg/schedule/operator" diff --git a/pkg/schedule/schedulers/config.go b/pkg/schedule/schedulers/config.go index 78b123981fd..e172b596685 100644 --- a/pkg/schedule/schedulers/config.go +++ b/pkg/schedule/schedulers/config.go @@ -15,13 +15,15 @@ package schedulers import ( + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) type schedulerConfig interface { diff --git a/pkg/schedule/schedulers/config_test.go b/pkg/schedule/schedulers/config_test.go index 9e20521854f..f97a2ad17ea 100644 --- a/pkg/schedule/schedulers/config_test.go +++ b/pkg/schedule/schedulers/config_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/storage" ) diff --git a/pkg/schedule/schedulers/evict_leader.go b/pkg/schedule/schedulers/evict_leader.go index defc65846ae..45285b51137 100644 --- a/pkg/schedule/schedulers/evict_leader.go +++ b/pkg/schedule/schedulers/evict_leader.go @@ -20,8 +20,12 @@ import ( "strconv" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" @@ -32,8 +36,6 @@ import ( "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/unrolled/render" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/schedulers/evict_leader_test.go b/pkg/schedule/schedulers/evict_leader_test.go index ecd80813c0f..587a48358e9 100644 --- a/pkg/schedule/schedulers/evict_leader_test.go +++ b/pkg/schedule/schedulers/evict_leader_test.go @@ -18,9 +18,11 @@ import ( "bytes" "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/schedule/types" diff --git a/pkg/schedule/schedulers/evict_slow_store.go b/pkg/schedule/schedulers/evict_slow_store.go index b1960ceca8e..8d8c014b110 100644 --- a/pkg/schedule/schedulers/evict_slow_store.go +++ b/pkg/schedule/schedulers/evict_slow_store.go @@ -19,9 +19,13 @@ import ( "time" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" sche "github.com/tikv/pd/pkg/schedule/core" @@ -29,8 +33,6 @@ import ( "github.com/tikv/pd/pkg/schedule/plan" "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/utils/apiutil" - "github.com/unrolled/render" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/schedulers/evict_slow_store_test.go b/pkg/schedule/schedulers/evict_slow_store_test.go index 79651fb5b5c..636d856fc14 100644 --- a/pkg/schedule/schedulers/evict_slow_store_test.go +++ b/pkg/schedule/schedulers/evict_slow_store_test.go @@ -18,8 +18,10 @@ import ( "context" "testing" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/schedule/operator" diff --git a/pkg/schedule/schedulers/evict_slow_trend.go b/pkg/schedule/schedulers/evict_slow_trend.go index 92805587f72..cf4bf3d3b39 100644 --- a/pkg/schedule/schedulers/evict_slow_trend.go +++ b/pkg/schedule/schedulers/evict_slow_trend.go @@ -20,9 +20,13 @@ import ( "time" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" sche "github.com/tikv/pd/pkg/schedule/core" @@ -31,8 +35,6 @@ import ( "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/unrolled/render" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/schedulers/evict_slow_trend_test.go b/pkg/schedule/schedulers/evict_slow_trend_test.go index 4be6eeb58d9..21420cc6022 100644 --- a/pkg/schedule/schedulers/evict_slow_trend_test.go +++ b/pkg/schedule/schedulers/evict_slow_trend_test.go @@ -19,9 +19,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/schedule/operator" diff --git a/pkg/schedule/schedulers/grant_hot_region.go b/pkg/schedule/schedulers/grant_hot_region.go index 88b9f5c6c93..837d7290ff7 100644 --- a/pkg/schedule/schedulers/grant_hot_region.go +++ b/pkg/schedule/schedulers/grant_hot_region.go @@ -21,8 +21,12 @@ import ( "strings" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" @@ -36,8 +40,6 @@ import ( "github.com/tikv/pd/pkg/statistics/utils" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/unrolled/render" - "go.uber.org/zap" ) type grantHotRegionSchedulerConfig struct { diff --git a/pkg/schedule/schedulers/grant_leader.go b/pkg/schedule/schedulers/grant_leader.go index b18d1fc3397..d0cb6bae34d 100644 --- a/pkg/schedule/schedulers/grant_leader.go +++ b/pkg/schedule/schedulers/grant_leader.go @@ -19,8 +19,12 @@ import ( "strconv" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" @@ -31,8 +35,6 @@ import ( "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/unrolled/render" - "go.uber.org/zap" ) type grantLeaderSchedulerConfig struct { diff --git a/pkg/schedule/schedulers/grant_leader_test.go b/pkg/schedule/schedulers/grant_leader_test.go index 38bac3c961a..003966db73d 100644 --- a/pkg/schedule/schedulers/grant_leader_test.go +++ b/pkg/schedule/schedulers/grant_leader_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/storage" diff --git a/pkg/schedule/schedulers/hot_region.go b/pkg/schedule/schedulers/hot_region.go index 97a558c3fe4..622e617b729 100644 --- a/pkg/schedule/schedulers/hot_region.go +++ b/pkg/schedule/schedulers/hot_region.go @@ -23,10 +23,13 @@ import ( "strconv" "time" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" @@ -41,7 +44,6 @@ import ( "github.com/tikv/pd/pkg/statistics/utils" "github.com/tikv/pd/pkg/utils/keyutil" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/schedulers/hot_region_config.go b/pkg/schedule/schedulers/hot_region_config.go index df82ccc3afc..c458d29842f 100644 --- a/pkg/schedule/schedulers/hot_region_config.go +++ b/pkg/schedule/schedulers/hot_region_config.go @@ -22,7 +22,11 @@ import ( "time" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" sche "github.com/tikv/pd/pkg/schedule/core" "github.com/tikv/pd/pkg/slice" @@ -31,8 +35,6 @@ import ( "github.com/tikv/pd/pkg/utils/reflectutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/pkg/versioninfo" - "github.com/unrolled/render" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/schedulers/hot_region_rank_v2_test.go b/pkg/schedule/schedulers/hot_region_rank_v2_test.go index f00e9dde787..d4cbfc092a0 100644 --- a/pkg/schedule/schedulers/hot_region_rank_v2_test.go +++ b/pkg/schedule/schedulers/hot_region_rank_v2_test.go @@ -19,6 +19,7 @@ import ( "github.com/docker/go-units" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/statistics/utils" diff --git a/pkg/schedule/schedulers/hot_region_test.go b/pkg/schedule/schedulers/hot_region_test.go index 9f79ac617c9..b37fc00cea1 100644 --- a/pkg/schedule/schedulers/hot_region_test.go +++ b/pkg/schedule/schedulers/hot_region_test.go @@ -22,9 +22,11 @@ import ( "time" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/schedule/operator" diff --git a/pkg/schedule/schedulers/label.go b/pkg/schedule/schedulers/label.go index a27ea29687e..cd63b6c0511 100644 --- a/pkg/schedule/schedulers/label.go +++ b/pkg/schedule/schedulers/label.go @@ -15,7 +15,10 @@ package schedulers import ( + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" @@ -25,7 +28,6 @@ import ( "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/schedule/plan" "github.com/tikv/pd/pkg/schedule/types" - "go.uber.org/zap" ) type labelSchedulerConfig struct { diff --git a/pkg/schedule/schedulers/metrics.go b/pkg/schedule/schedulers/metrics.go index 4afc4605f52..bd8a2b4f6ea 100644 --- a/pkg/schedule/schedulers/metrics.go +++ b/pkg/schedule/schedulers/metrics.go @@ -16,6 +16,7 @@ package schedulers import ( "github.com/prometheus/client_golang/prometheus" + "github.com/tikv/pd/pkg/schedule/types" ) diff --git a/pkg/schedule/schedulers/random_merge.go b/pkg/schedule/schedulers/random_merge.go index 7cd9954ce4b..ccb1bc12f9a 100644 --- a/pkg/schedule/schedulers/random_merge.go +++ b/pkg/schedule/schedulers/random_merge.go @@ -18,6 +18,7 @@ import ( "math/rand" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" diff --git a/pkg/schedule/schedulers/random_merge_test.go b/pkg/schedule/schedulers/random_merge_test.go index 6c8ea353f2d..e7be6d589ba 100644 --- a/pkg/schedule/schedulers/random_merge_test.go +++ b/pkg/schedule/schedulers/random_merge_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/storage" diff --git a/pkg/schedule/schedulers/range_cluster.go b/pkg/schedule/schedulers/range_cluster.go index e83e74145f6..0b6e908b56c 100644 --- a/pkg/schedule/schedulers/range_cluster.go +++ b/pkg/schedule/schedulers/range_cluster.go @@ -16,6 +16,7 @@ package schedulers import ( "github.com/docker/go-units" + "github.com/tikv/pd/pkg/core" sche "github.com/tikv/pd/pkg/schedule/core" ) diff --git a/pkg/schedule/schedulers/scatter_range.go b/pkg/schedule/schedulers/scatter_range.go index 5ba303ad05a..2e071ec6ca7 100644 --- a/pkg/schedule/schedulers/scatter_range.go +++ b/pkg/schedule/schedulers/scatter_range.go @@ -19,7 +19,10 @@ import ( "net/http" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" sche "github.com/tikv/pd/pkg/schedule/core" @@ -28,7 +31,6 @@ import ( "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/unrolled/render" ) type scatterRangeSchedulerConfig struct { diff --git a/pkg/schedule/schedulers/scatter_range_test.go b/pkg/schedule/schedulers/scatter_range_test.go index 26ac48a36bb..7125ba9a596 100644 --- a/pkg/schedule/schedulers/scatter_range_test.go +++ b/pkg/schedule/schedulers/scatter_range_test.go @@ -19,8 +19,10 @@ import ( "math/rand" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/storage" diff --git a/pkg/schedule/schedulers/scheduler.go b/pkg/schedule/schedulers/scheduler.go index 3f722f7f804..8976c3a1928 100644 --- a/pkg/schedule/schedulers/scheduler.go +++ b/pkg/schedule/schedulers/scheduler.go @@ -20,8 +20,11 @@ import ( "strings" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/schedule/config" sche "github.com/tikv/pd/pkg/schedule/core" @@ -29,7 +32,6 @@ import ( "github.com/tikv/pd/pkg/schedule/plan" "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/storage/endpoint" - "go.uber.org/zap" ) // Scheduler is an interface to schedule resources. diff --git a/pkg/schedule/schedulers/scheduler_controller.go b/pkg/schedule/schedulers/scheduler_controller.go index cb4ffd6f9c2..28973631570 100644 --- a/pkg/schedule/schedulers/scheduler_controller.go +++ b/pkg/schedule/schedulers/scheduler_controller.go @@ -22,7 +22,10 @@ import ( "sync/atomic" "time" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" sche "github.com/tikv/pd/pkg/schedule/core" @@ -33,7 +36,6 @@ import ( "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) const maxScheduleRetries = 10 diff --git a/pkg/schedule/schedulers/scheduler_test.go b/pkg/schedule/schedulers/scheduler_test.go index 0e06b9333e9..24df62ad3e1 100644 --- a/pkg/schedule/schedulers/scheduler_test.go +++ b/pkg/schedule/schedulers/scheduler_test.go @@ -20,8 +20,10 @@ import ( "testing" "github.com/docker/go-units" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/schedule/schedulers/shuffle_hot_region.go b/pkg/schedule/schedulers/shuffle_hot_region.go index 7517abb3c21..6da4b71ea45 100644 --- a/pkg/schedule/schedulers/shuffle_hot_region.go +++ b/pkg/schedule/schedulers/shuffle_hot_region.go @@ -18,8 +18,12 @@ import ( "net/http" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" sche "github.com/tikv/pd/pkg/schedule/core" @@ -30,8 +34,6 @@ import ( "github.com/tikv/pd/pkg/statistics" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/unrolled/render" - "go.uber.org/zap" ) type shuffleHotRegionSchedulerConfig struct { diff --git a/pkg/schedule/schedulers/shuffle_leader.go b/pkg/schedule/schedulers/shuffle_leader.go index e2a256af7a7..8fd5b87c1bc 100644 --- a/pkg/schedule/schedulers/shuffle_leader.go +++ b/pkg/schedule/schedulers/shuffle_leader.go @@ -16,6 +16,7 @@ package schedulers import ( "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" diff --git a/pkg/schedule/schedulers/shuffle_region.go b/pkg/schedule/schedulers/shuffle_region.go index 1fbc1f08e67..2b4e2443210 100644 --- a/pkg/schedule/schedulers/shuffle_region.go +++ b/pkg/schedule/schedulers/shuffle_region.go @@ -18,6 +18,7 @@ import ( "net/http" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" sche "github.com/tikv/pd/pkg/schedule/core" diff --git a/pkg/schedule/schedulers/shuffle_region_config.go b/pkg/schedule/schedulers/shuffle_region_config.go index 2e3394a58df..58ea25b6186 100644 --- a/pkg/schedule/schedulers/shuffle_region_config.go +++ b/pkg/schedule/schedulers/shuffle_region_config.go @@ -18,12 +18,13 @@ import ( "net/http" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/placement" "github.com/tikv/pd/pkg/slice" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/unrolled/render" ) const ( diff --git a/pkg/schedule/schedulers/split_bucket.go b/pkg/schedule/schedulers/split_bucket.go index edbe2ac3545..d6aee65b181 100644 --- a/pkg/schedule/schedulers/split_bucket.go +++ b/pkg/schedule/schedulers/split_bucket.go @@ -22,8 +22,11 @@ import ( "strconv" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" sche "github.com/tikv/pd/pkg/schedule/core" "github.com/tikv/pd/pkg/schedule/operator" @@ -32,7 +35,6 @@ import ( "github.com/tikv/pd/pkg/statistics/buckets" "github.com/tikv/pd/pkg/utils/reflectutil" "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/unrolled/render" ) const ( diff --git a/pkg/schedule/schedulers/split_bucket_test.go b/pkg/schedule/schedulers/split_bucket_test.go index 840dfa97c19..41892bb4fc4 100644 --- a/pkg/schedule/schedulers/split_bucket_test.go +++ b/pkg/schedule/schedulers/split_bucket_test.go @@ -18,8 +18,10 @@ import ( "fmt" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/statistics/buckets" diff --git a/pkg/schedule/schedulers/transfer_witness_leader.go b/pkg/schedule/schedulers/transfer_witness_leader.go index 90191dd355c..c84f0918884 100644 --- a/pkg/schedule/schedulers/transfer_witness_leader.go +++ b/pkg/schedule/schedulers/transfer_witness_leader.go @@ -19,6 +19,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" diff --git a/pkg/schedule/schedulers/transfer_witness_leader_test.go b/pkg/schedule/schedulers/transfer_witness_leader_test.go index b100e0a9535..e58f3dd3544 100644 --- a/pkg/schedule/schedulers/transfer_witness_leader_test.go +++ b/pkg/schedule/schedulers/transfer_witness_leader_test.go @@ -17,9 +17,11 @@ package schedulers import ( "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/schedule/types" diff --git a/pkg/schedule/schedulers/utils.go b/pkg/schedule/schedulers/utils.go index 9c1c7fe3854..9a6a6bd96fa 100644 --- a/pkg/schedule/schedulers/utils.go +++ b/pkg/schedule/schedulers/utils.go @@ -19,7 +19,10 @@ import ( "strconv" "time" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" @@ -28,7 +31,6 @@ import ( "github.com/tikv/pd/pkg/schedule/placement" "github.com/tikv/pd/pkg/schedule/plan" "github.com/tikv/pd/pkg/statistics" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/schedulers/utils_test.go b/pkg/schedule/schedulers/utils_test.go index deb7c6e1038..d85fba47ff4 100644 --- a/pkg/schedule/schedulers/utils_test.go +++ b/pkg/schedule/schedulers/utils_test.go @@ -17,8 +17,10 @@ package schedulers import ( "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" ) diff --git a/pkg/schedule/splitter/region_splitter.go b/pkg/schedule/splitter/region_splitter.go index 37b33dad480..c5b950d73be 100644 --- a/pkg/schedule/splitter/region_splitter.go +++ b/pkg/schedule/splitter/region_splitter.go @@ -22,15 +22,17 @@ import ( "math" "time" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" sche "github.com/tikv/pd/pkg/schedule/core" "github.com/tikv/pd/pkg/schedule/filter" "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/schedule/splitter/region_splitter_test.go b/pkg/schedule/splitter/region_splitter_test.go index 6f49707217e..8e59fa74382 100644 --- a/pkg/schedule/splitter/region_splitter_test.go +++ b/pkg/schedule/splitter/region_splitter_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/slice/slice_test.go b/pkg/slice/slice_test.go index 019cd49c46a..c0abb46f298 100644 --- a/pkg/slice/slice_test.go +++ b/pkg/slice/slice_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/slice" ) diff --git a/pkg/statistics/buckets/hot_bucket_cache.go b/pkg/statistics/buckets/hot_bucket_cache.go index 3fc640e8c1f..f29ef1563e8 100644 --- a/pkg/statistics/buckets/hot_bucket_cache.go +++ b/pkg/statistics/buckets/hot_bucket_cache.go @@ -19,12 +19,14 @@ import ( "context" "time" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core/rangetree" "github.com/tikv/pd/pkg/utils/keyutil" "github.com/tikv/pd/pkg/utils/logutil" - "go.uber.org/zap" ) type status int diff --git a/pkg/statistics/buckets/hot_bucket_cache_test.go b/pkg/statistics/buckets/hot_bucket_cache_test.go index e9669eb2eec..06e00687fd7 100644 --- a/pkg/statistics/buckets/hot_bucket_cache_test.go +++ b/pkg/statistics/buckets/hot_bucket_cache_test.go @@ -18,8 +18,9 @@ import ( "context" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" ) func TestPutItem(t *testing.T) { diff --git a/pkg/statistics/buckets/hot_bucket_task_test.go b/pkg/statistics/buckets/hot_bucket_task_test.go index 100ed7c818d..93551919ba2 100644 --- a/pkg/statistics/buckets/hot_bucket_task_test.go +++ b/pkg/statistics/buckets/hot_bucket_task_test.go @@ -21,8 +21,9 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" ) func getAllBucketStats(ctx context.Context, hotCache *HotBucketCache) map[uint64][]*BucketStat { diff --git a/pkg/statistics/hot_cache.go b/pkg/statistics/hot_cache.go index ae61063646d..99ec587aea7 100644 --- a/pkg/statistics/hot_cache.go +++ b/pkg/statistics/hot_cache.go @@ -17,8 +17,10 @@ package statistics import ( "context" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/smallnest/chanx" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/statistics/utils" "github.com/tikv/pd/pkg/utils/logutil" diff --git a/pkg/statistics/hot_cache_test.go b/pkg/statistics/hot_cache_test.go index b0232b658d4..668c930adcc 100644 --- a/pkg/statistics/hot_cache_test.go +++ b/pkg/statistics/hot_cache_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/statistics/utils" ) diff --git a/pkg/statistics/hot_peer.go b/pkg/statistics/hot_peer.go index c17ad5c246f..55dcd03b4ee 100644 --- a/pkg/statistics/hot_peer.go +++ b/pkg/statistics/hot_peer.go @@ -18,12 +18,14 @@ import ( "math" "time" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/movingaverage" "github.com/tikv/pd/pkg/slice" "github.com/tikv/pd/pkg/statistics/utils" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) type dimStat struct { diff --git a/pkg/statistics/hot_peer_cache.go b/pkg/statistics/hot_peer_cache.go index b62248062bd..77b5d567ca4 100644 --- a/pkg/statistics/hot_peer_cache.go +++ b/pkg/statistics/hot_peer_cache.go @@ -20,9 +20,11 @@ import ( "math" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/prometheus/client_golang/prometheus" "github.com/smallnest/chanx" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/slice" "github.com/tikv/pd/pkg/statistics/utils" diff --git a/pkg/statistics/hot_peer_cache_test.go b/pkg/statistics/hot_peer_cache_test.go index 2d44b5dc783..09d267d60b9 100644 --- a/pkg/statistics/hot_peer_cache_test.go +++ b/pkg/statistics/hot_peer_cache_test.go @@ -23,9 +23,11 @@ import ( "time" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockid" "github.com/tikv/pd/pkg/movingaverage" diff --git a/pkg/statistics/region_collection.go b/pkg/statistics/region_collection.go index 958ba3be5df..8d12dbf42c9 100644 --- a/pkg/statistics/region_collection.go +++ b/pkg/statistics/region_collection.go @@ -17,12 +17,14 @@ package statistics import ( "time" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/schedule/placement" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) // RegionInfoProvider is an interface to provide the region information. diff --git a/pkg/statistics/region_collection_test.go b/pkg/statistics/region_collection_test.go index 64a625a04e2..f97dffa893d 100644 --- a/pkg/statistics/region_collection_test.go +++ b/pkg/statistics/region_collection_test.go @@ -18,9 +18,11 @@ import ( "context" "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockconfig" "github.com/tikv/pd/pkg/schedule/placement" diff --git a/pkg/statistics/store.go b/pkg/statistics/store.go index baeef0ad417..fbbfea72700 100644 --- a/pkg/statistics/store.go +++ b/pkg/statistics/store.go @@ -17,13 +17,15 @@ package statistics import ( "time" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/movingaverage" "github.com/tikv/pd/pkg/statistics/utils" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/statistics/store_collection.go b/pkg/statistics/store_collection.go index f55c23b27b7..a7c77aa7b4b 100644 --- a/pkg/statistics/store_collection.go +++ b/pkg/statistics/store_collection.go @@ -19,6 +19,7 @@ import ( "strconv" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/core/storelimit" diff --git a/pkg/statistics/store_collection_test.go b/pkg/statistics/store_collection_test.go index 6a0ef24aff5..93845d4de1a 100644 --- a/pkg/statistics/store_collection_test.go +++ b/pkg/statistics/store_collection_test.go @@ -20,9 +20,11 @@ import ( "time" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/mock/mockconfig" diff --git a/pkg/statistics/store_load_test.go b/pkg/statistics/store_load_test.go index 9d958151182..cbcbb0bacfe 100644 --- a/pkg/statistics/store_load_test.go +++ b/pkg/statistics/store_load_test.go @@ -19,6 +19,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/statistics/utils" ) diff --git a/pkg/statistics/store_test.go b/pkg/statistics/store_test.go index ccf85caaa72..741fdc54fd3 100644 --- a/pkg/statistics/store_test.go +++ b/pkg/statistics/store_test.go @@ -18,9 +18,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" ) diff --git a/pkg/statistics/utils/kind_test.go b/pkg/statistics/utils/kind_test.go index 0a02ffa00c1..d0834e077da 100644 --- a/pkg/statistics/utils/kind_test.go +++ b/pkg/statistics/utils/kind_test.go @@ -17,9 +17,11 @@ package utils import ( "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" ) diff --git a/pkg/storage/endpoint/cluster_id.go b/pkg/storage/endpoint/cluster_id.go index 974b65d6c6c..f9317d44874 100644 --- a/pkg/storage/endpoint/cluster_id.go +++ b/pkg/storage/endpoint/cluster_id.go @@ -19,14 +19,16 @@ import ( "math/rand" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/typeutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // InitClusterID creates a cluster ID if it hasn't existed. diff --git a/pkg/storage/endpoint/cluster_id_test.go b/pkg/storage/endpoint/cluster_id_test.go index 5ce1600044d..dcd06e15053 100644 --- a/pkg/storage/endpoint/cluster_id_test.go +++ b/pkg/storage/endpoint/cluster_id_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" ) diff --git a/pkg/storage/endpoint/config.go b/pkg/storage/endpoint/config.go index d297562f275..0c96de0a8cc 100644 --- a/pkg/storage/endpoint/config.go +++ b/pkg/storage/endpoint/config.go @@ -18,9 +18,10 @@ import ( "encoding/json" "strings" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/keypath" - clientv3 "go.etcd.io/etcd/client/v3" ) // ConfigStorage defines the storage operations on the config. diff --git a/pkg/storage/endpoint/gc_safe_point.go b/pkg/storage/endpoint/gc_safe_point.go index 8a6c5c5f789..15d3b3c47a1 100644 --- a/pkg/storage/endpoint/gc_safe_point.go +++ b/pkg/storage/endpoint/gc_safe_point.go @@ -20,11 +20,13 @@ import ( "strconv" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/keypath" - clientv3 "go.etcd.io/etcd/client/v3" ) // ServiceSafePoint is the safepoint for a specific service diff --git a/pkg/storage/endpoint/keyspace.go b/pkg/storage/endpoint/keyspace.go index 77240541951..e1c7ae4c846 100644 --- a/pkg/storage/endpoint/keyspace.go +++ b/pkg/storage/endpoint/keyspace.go @@ -19,11 +19,13 @@ import ( "strconv" "github.com/gogo/protobuf/proto" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/keypath" - clientv3 "go.etcd.io/etcd/client/v3" ) const ( diff --git a/pkg/storage/endpoint/meta.go b/pkg/storage/endpoint/meta.go index 176188be3f3..73b7c397ff4 100644 --- a/pkg/storage/endpoint/meta.go +++ b/pkg/storage/endpoint/meta.go @@ -21,8 +21,10 @@ import ( "time" "github.com/gogo/protobuf/proto" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/encryption" "github.com/tikv/pd/pkg/errs" diff --git a/pkg/storage/endpoint/resource_group.go b/pkg/storage/endpoint/resource_group.go index 733e5ba2c9a..431c869ac70 100644 --- a/pkg/storage/endpoint/resource_group.go +++ b/pkg/storage/endpoint/resource_group.go @@ -16,6 +16,7 @@ package endpoint import ( "github.com/gogo/protobuf/proto" + "github.com/tikv/pd/pkg/utils/keypath" ) diff --git a/pkg/storage/endpoint/safepoint_v2.go b/pkg/storage/endpoint/safepoint_v2.go index f16855e86d6..12659847510 100644 --- a/pkg/storage/endpoint/safepoint_v2.go +++ b/pkg/storage/endpoint/safepoint_v2.go @@ -19,12 +19,14 @@ import ( "math" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/keypath" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // GCSafePointV2 represents the overall safe point for a specific keyspace. diff --git a/pkg/storage/endpoint/tso.go b/pkg/storage/endpoint/tso.go index 77841529e98..697001dfe7c 100644 --- a/pkg/storage/endpoint/tso.go +++ b/pkg/storage/endpoint/tso.go @@ -19,13 +19,15 @@ import ( "strings" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/typeutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // TSOStorage is the interface for timestamp storage. diff --git a/pkg/storage/endpoint/tso_keyspace_group.go b/pkg/storage/endpoint/tso_keyspace_group.go index b45d1f1da37..ef9a23308a6 100644 --- a/pkg/storage/endpoint/tso_keyspace_group.go +++ b/pkg/storage/endpoint/tso_keyspace_group.go @@ -18,11 +18,12 @@ import ( "context" "encoding/json" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/tikv/pd/pkg/slice" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/typeutil" - clientv3 "go.etcd.io/etcd/client/v3" ) // UserKind represents the user kind. diff --git a/pkg/storage/endpoint/util.go b/pkg/storage/endpoint/util.go index 39aa6240f5a..e8f17a3922f 100644 --- a/pkg/storage/endpoint/util.go +++ b/pkg/storage/endpoint/util.go @@ -20,10 +20,11 @@ import ( "strings" "github.com/gogo/protobuf/proto" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/etcdutil" - clientv3 "go.etcd.io/etcd/client/v3" ) func (se *StorageEndpoint) loadProto(key string, msg proto.Message) (bool, error) { diff --git a/pkg/storage/etcd_backend.go b/pkg/storage/etcd_backend.go index e9af5fc67f6..b967d99b37b 100644 --- a/pkg/storage/etcd_backend.go +++ b/pkg/storage/etcd_backend.go @@ -15,9 +15,10 @@ package storage import ( + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/storage/kv" - clientv3 "go.etcd.io/etcd/client/v3" ) // etcdBackend is a storage backend that stores data in etcd, diff --git a/pkg/storage/hot_region_storage.go b/pkg/storage/hot_region_storage.go index d323b40d435..b5ec8dda6ba 100644 --- a/pkg/storage/hot_region_storage.go +++ b/pkg/storage/hot_region_storage.go @@ -24,12 +24,15 @@ import ( "sync" "time" - "github.com/pingcap/kvproto/pkg/encryptionpb" - "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/log" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/iterator" "github.com/syndtr/goleveldb/leveldb/util" + "go.uber.org/zap" + + "github.com/pingcap/kvproto/pkg/encryptionpb" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/encryption" "github.com/tikv/pd/pkg/errs" @@ -37,7 +40,6 @@ import ( "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) // HotRegionStorage is used to store the hot region info. diff --git a/pkg/storage/hot_region_storage_test.go b/pkg/storage/hot_region_storage_test.go index aeda8e450e7..cd713685eb0 100644 --- a/pkg/storage/hot_region_storage_test.go +++ b/pkg/storage/hot_region_storage_test.go @@ -26,6 +26,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/statistics/utils" ) diff --git a/pkg/storage/keyspace_test.go b/pkg/storage/keyspace_test.go index a6ce94e4711..7841f5da22d 100644 --- a/pkg/storage/keyspace_test.go +++ b/pkg/storage/keyspace_test.go @@ -19,8 +19,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/keypath" ) diff --git a/pkg/storage/kv/etcd_kv.go b/pkg/storage/kv/etcd_kv.go index 5945990c51b..c25f4d66060 100644 --- a/pkg/storage/kv/etcd_kv.go +++ b/pkg/storage/kv/etcd_kv.go @@ -20,13 +20,15 @@ import ( "strings" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/etcdutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const ( diff --git a/pkg/storage/kv/kv_test.go b/pkg/storage/kv/kv_test.go index f57c8145bd0..f05561b0c0b 100644 --- a/pkg/storage/kv/kv_test.go +++ b/pkg/storage/kv/kv_test.go @@ -22,8 +22,9 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/utils/etcdutil" clientv3 "go.etcd.io/etcd/client/v3" + + "github.com/tikv/pd/pkg/utils/etcdutil" ) func TestEtcd(t *testing.T) { diff --git a/pkg/storage/kv/levedb_kv.go b/pkg/storage/kv/levedb_kv.go index 6f93cd0237f..5a74c1928e8 100644 --- a/pkg/storage/kv/levedb_kv.go +++ b/pkg/storage/kv/levedb_kv.go @@ -17,9 +17,11 @@ package kv import ( "context" - "github.com/pingcap/errors" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/util" + + "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/syncutil" ) diff --git a/pkg/storage/kv/mem_kv.go b/pkg/storage/kv/mem_kv.go index dc24ab3e0f6..cc5dca29851 100644 --- a/pkg/storage/kv/mem_kv.go +++ b/pkg/storage/kv/mem_kv.go @@ -18,8 +18,10 @@ import ( "context" "github.com/google/btree" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/utils/syncutil" ) diff --git a/pkg/storage/leveldb_backend.go b/pkg/storage/leveldb_backend.go index 8fb1db196c1..096a762db65 100644 --- a/pkg/storage/leveldb_backend.go +++ b/pkg/storage/leveldb_backend.go @@ -18,9 +18,11 @@ import ( "context" "time" + "github.com/syndtr/goleveldb/leveldb" + "github.com/pingcap/failpoint" "github.com/pingcap/log" - "github.com/syndtr/goleveldb/leveldb" + "github.com/tikv/pd/pkg/encryption" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/endpoint" diff --git a/pkg/storage/leveldb_backend_test.go b/pkg/storage/leveldb_backend_test.go index c6e0fcef607..0bf626834cd 100644 --- a/pkg/storage/leveldb_backend_test.go +++ b/pkg/storage/leveldb_backend_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/testutil" ) diff --git a/pkg/storage/region_storage.go b/pkg/storage/region_storage.go index 5a581ec5155..8e6a4d87429 100644 --- a/pkg/storage/region_storage.go +++ b/pkg/storage/region_storage.go @@ -18,7 +18,9 @@ import ( "context" "github.com/gogo/protobuf/proto" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/encryption" "github.com/tikv/pd/pkg/errs" diff --git a/pkg/storage/region_storage_test.go b/pkg/storage/region_storage_test.go index f6670f8c82e..c0ae04c8ded 100644 --- a/pkg/storage/region_storage_test.go +++ b/pkg/storage/region_storage_test.go @@ -18,8 +18,10 @@ import ( "context" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/storage/endpoint" ) diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index dce2f1712b8..34f2357c8f7 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -18,13 +18,15 @@ import ( "context" "sync/atomic" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/encryption" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/syncutil" - clientv3 "go.etcd.io/etcd/client/v3" ) // Storage is the interface for the backend storage of the PD. diff --git a/pkg/storage/storage_gc_test.go b/pkg/storage/storage_gc_test.go index b18fcc12afc..ffffab620b3 100644 --- a/pkg/storage/storage_gc_test.go +++ b/pkg/storage/storage_gc_test.go @@ -19,8 +19,10 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/keypath" ) diff --git a/pkg/storage/storage_test.go b/pkg/storage/storage_test.go index ca1c8e275eb..e6c12f37cbb 100644 --- a/pkg/storage/storage_test.go +++ b/pkg/storage/storage_test.go @@ -25,13 +25,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/keypath" - clientv3 "go.etcd.io/etcd/client/v3" ) func TestBasic(t *testing.T) { diff --git a/pkg/storage/storage_tso_test.go b/pkg/storage/storage_tso_test.go index 07ea79df47c..e8b49106a09 100644 --- a/pkg/storage/storage_tso_test.go +++ b/pkg/storage/storage_tso_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" ) diff --git a/pkg/syncer/client.go b/pkg/syncer/client.go index 3d7f36d9114..81652045cbf 100644 --- a/pkg/syncer/client.go +++ b/pkg/syncer/client.go @@ -19,11 +19,19 @@ import ( "time" "github.com/docker/go-units" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/status" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/ratelimit" @@ -31,12 +39,6 @@ import ( "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/logutil" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/backoff" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/status" ) const ( diff --git a/pkg/syncer/client_test.go b/pkg/syncer/client_test.go index 926be3421ab..03f18fd2b76 100644 --- a/pkg/syncer/client_test.go +++ b/pkg/syncer/client_test.go @@ -19,15 +19,17 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockserver" "github.com/tikv/pd/pkg/storage" "github.com/tikv/pd/pkg/utils/grpcutil" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) // For issue https://github.com/tikv/pd/issues/3936 diff --git a/pkg/syncer/history_buffer.go b/pkg/syncer/history_buffer.go index 7ff6f202ad3..cb30eb56ee3 100644 --- a/pkg/syncer/history_buffer.go +++ b/pkg/syncer/history_buffer.go @@ -17,12 +17,14 @@ package syncer import ( "strconv" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/kv" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/syncer/history_buffer_test.go b/pkg/syncer/history_buffer_test.go index 6bcd58b1689..368cecf5a3b 100644 --- a/pkg/syncer/history_buffer_test.go +++ b/pkg/syncer/history_buffer_test.go @@ -17,8 +17,10 @@ package syncer import ( "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/storage/kv" ) diff --git a/pkg/syncer/server.go b/pkg/syncer/server.go index 6009bba1d7d..89af3f79ccc 100644 --- a/pkg/syncer/server.go +++ b/pkg/syncer/server.go @@ -22,11 +22,16 @@ import ( "time" "github.com/docker/go-units" + "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/ratelimit" @@ -35,9 +40,6 @@ import ( "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/syncutil" - "go.uber.org/zap" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) const ( diff --git a/pkg/systimemon/systimemon.go b/pkg/systimemon/systimemon.go index 75fc5e68d8b..e3aa67d8d7c 100644 --- a/pkg/systimemon/systimemon.go +++ b/pkg/systimemon/systimemon.go @@ -18,10 +18,12 @@ import ( "context" "time" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/logutil" - "go.uber.org/zap" ) // StartMonitor calls systimeErrHandler if system time jump backward. diff --git a/pkg/tso/admin.go b/pkg/tso/admin.go index bc9fd1f853d..f74abb29fcb 100644 --- a/pkg/tso/admin.go +++ b/pkg/tso/admin.go @@ -19,9 +19,10 @@ import ( "net/http" "strconv" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/apiutil" - "github.com/unrolled/render" ) // Handler defines the common behaviors of a basic tso handler. diff --git a/pkg/tso/allocator_manager.go b/pkg/tso/allocator_manager.go index 65f61e819d1..fda5c6088ab 100644 --- a/pkg/tso/allocator_manager.go +++ b/pkg/tso/allocator_manager.go @@ -21,9 +21,13 @@ import ( "sync" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/election" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/member" @@ -31,8 +35,6 @@ import ( "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const ( diff --git a/pkg/tso/global_allocator.go b/pkg/tso/global_allocator.go index 2fe0df3e000..d6bf27878a7 100644 --- a/pkg/tso/global_allocator.go +++ b/pkg/tso/global_allocator.go @@ -24,9 +24,12 @@ import ( "sync/atomic" "time" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus" + "github.com/tikv/pd/pkg/election" "github.com/tikv/pd/pkg/errs" mcsutils "github.com/tikv/pd/pkg/mcs/utils" @@ -34,7 +37,6 @@ import ( "github.com/tikv/pd/pkg/member" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/logutil" - "go.uber.org/zap" ) // Allocator is a Timestamp Oracle allocator. diff --git a/pkg/tso/keyspace_group_manager.go b/pkg/tso/keyspace_group_manager.go index bb5fb4587f7..d22d284e1be 100644 --- a/pkg/tso/keyspace_group_manager.go +++ b/pkg/tso/keyspace_group_manager.go @@ -25,11 +25,16 @@ import ( "sync" "time" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + perrors "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/election" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/discovery" @@ -47,9 +52,6 @@ import ( "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/tsoutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const ( diff --git a/pkg/tso/keyspace_group_manager_test.go b/pkg/tso/keyspace_group_manager_test.go index be3d53785cd..b4393a23471 100644 --- a/pkg/tso/keyspace_group_manager_test.go +++ b/pkg/tso/keyspace_group_manager_test.go @@ -28,9 +28,14 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/goleak" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/mcs/discovery" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/storage/endpoint" @@ -41,9 +46,6 @@ import ( "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/utils/tsoutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/pkg/tso/tso.go b/pkg/tso/tso.go index 0210c98626b..5293780b22f 100644 --- a/pkg/tso/tso.go +++ b/pkg/tso/tso.go @@ -21,9 +21,13 @@ import ( "sync/atomic" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/election" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/endpoint" @@ -32,8 +36,6 @@ import ( "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/tsoutil" "github.com/tikv/pd/pkg/utils/typeutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const ( diff --git a/pkg/tso/util_test.go b/pkg/tso/util_test.go index f31f8781ded..c2922d49b7f 100644 --- a/pkg/tso/util_test.go +++ b/pkg/tso/util_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/keypath" ) diff --git a/pkg/unsaferecovery/unsafe_recovery_controller.go b/pkg/unsaferecovery/unsafe_recovery_controller.go index aa3cf192270..dce2069e316 100644 --- a/pkg/unsaferecovery/unsafe_recovery_controller.go +++ b/pkg/unsaferecovery/unsafe_recovery_controller.go @@ -23,10 +23,13 @@ import ( "strings" "time" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/btree" "github.com/tikv/pd/pkg/codec" "github.com/tikv/pd/pkg/core" @@ -35,7 +38,6 @@ import ( "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/typeutil" - "go.uber.org/zap" ) // stage is the stage of unsafe recovery. diff --git a/pkg/unsaferecovery/unsafe_recovery_controller_test.go b/pkg/unsaferecovery/unsafe_recovery_controller_test.go index feaf5ba7430..0dab6aeca1d 100644 --- a/pkg/unsaferecovery/unsafe_recovery_controller_test.go +++ b/pkg/unsaferecovery/unsafe_recovery_controller_test.go @@ -21,11 +21,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/eraftpb" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/raft_serverpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/codec" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mock/mockcluster" diff --git a/pkg/utils/apiutil/apiutil.go b/pkg/utils/apiutil/apiutil.go index 20465d8376c..a743c543468 100644 --- a/pkg/utils/apiutil/apiutil.go +++ b/pkg/utils/apiutil/apiutil.go @@ -33,13 +33,15 @@ import ( "github.com/gin-gonic/gin" "github.com/gorilla/mux" "github.com/joho/godotenv" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/errcode" "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/slice" - "github.com/unrolled/render" - "go.uber.org/zap" ) const ( diff --git a/pkg/utils/apiutil/multiservicesapi/middleware.go b/pkg/utils/apiutil/multiservicesapi/middleware.go index 4343adcc981..5362475f9ad 100644 --- a/pkg/utils/apiutil/multiservicesapi/middleware.go +++ b/pkg/utils/apiutil/multiservicesapi/middleware.go @@ -19,11 +19,13 @@ import ( "net/url" "github.com/gin-gonic/gin" + "go.uber.org/zap" + "github.com/pingcap/log" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/apiutil" - "go.uber.org/zap" ) const ( diff --git a/pkg/utils/apiutil/serverapi/middleware.go b/pkg/utils/apiutil/serverapi/middleware.go index d6fc98082d6..85b958a5554 100644 --- a/pkg/utils/apiutil/serverapi/middleware.go +++ b/pkg/utils/apiutil/serverapi/middleware.go @@ -20,15 +20,17 @@ import ( "strings" "time" + "github.com/urfave/negroni" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/slice" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" - "github.com/urfave/negroni" - "go.uber.org/zap" ) type runtimeServiceValidator struct { diff --git a/pkg/utils/configutil/configutil.go b/pkg/utils/configutil/configutil.go index 48be7ff8c02..fe680879f73 100644 --- a/pkg/utils/configutil/configutil.go +++ b/pkg/utils/configutil/configutil.go @@ -21,8 +21,10 @@ import ( "time" "github.com/BurntSushi/toml" - "github.com/pingcap/errors" "github.com/spf13/pflag" + + "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/encryption" "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/pkg/utils/logutil" diff --git a/pkg/utils/etcdutil/etcdutil.go b/pkg/utils/etcdutil/etcdutil.go index 70beae943f8..3e9eaa765ab 100644 --- a/pkg/utils/etcdutil/etcdutil.go +++ b/pkg/utils/etcdutil/etcdutil.go @@ -24,13 +24,6 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/pingcap/errors" - "github.com/pingcap/failpoint" - "github.com/pingcap/log" - "github.com/tikv/pd/pkg/errs" - "github.com/tikv/pd/pkg/utils/grpcutil" - "github.com/tikv/pd/pkg/utils/logutil" - "github.com/tikv/pd/pkg/utils/syncutil" "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/mvccpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" @@ -39,6 +32,15 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver" "go.uber.org/zap" "google.golang.org/grpc/codes" + + "github.com/pingcap/errors" + "github.com/pingcap/failpoint" + "github.com/pingcap/log" + + "github.com/tikv/pd/pkg/errs" + "github.com/tikv/pd/pkg/utils/grpcutil" + "github.com/tikv/pd/pkg/utils/logutil" + "github.com/tikv/pd/pkg/utils/syncutil" ) const ( diff --git a/pkg/utils/etcdutil/etcdutil_test.go b/pkg/utils/etcdutil/etcdutil_test.go index 92ec8967d03..43c25539207 100644 --- a/pkg/utils/etcdutil/etcdutil_test.go +++ b/pkg/utils/etcdutil/etcdutil_test.go @@ -28,18 +28,20 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/tikv/pd/pkg/utils/tempurl" - "github.com/tikv/pd/pkg/utils/testutil" "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/mvccpb" etcdtypes "go.etcd.io/etcd/client/pkg/v3/types" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/server/v3/embed" "go.uber.org/goleak" + + "github.com/pingcap/failpoint" + + "github.com/tikv/pd/pkg/utils/syncutil" + "github.com/tikv/pd/pkg/utils/tempurl" + "github.com/tikv/pd/pkg/utils/testutil" ) func TestMain(m *testing.M) { diff --git a/pkg/utils/etcdutil/health_checker.go b/pkg/utils/etcdutil/health_checker.go index d75814ec380..eafb6293238 100644 --- a/pkg/utils/etcdutil/health_checker.go +++ b/pkg/utils/etcdutil/health_checker.go @@ -21,13 +21,15 @@ import ( "sync" "time" - "github.com/pingcap/log" "github.com/prometheus/client_golang/prometheus" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/typeutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const pickedCountThreshold = 3 diff --git a/pkg/utils/etcdutil/testutil.go b/pkg/utils/etcdutil/testutil.go index 7cb718664d9..daca4254467 100644 --- a/pkg/utils/etcdutil/testutil.go +++ b/pkg/utils/etcdutil/testutil.go @@ -22,11 +22,12 @@ import ( "time" "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/utils/tempurl" - "github.com/tikv/pd/pkg/utils/testutil" "go.etcd.io/etcd/api/v3/etcdserverpb" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/server/v3/embed" + + "github.com/tikv/pd/pkg/utils/tempurl" + "github.com/tikv/pd/pkg/utils/testutil" ) // NewTestSingleConfig is used to create a etcd config for the unit test purpose. diff --git a/pkg/utils/grpcutil/grpcutil.go b/pkg/utils/grpcutil/grpcutil.go index 1d1e6478036..aea65dd32dd 100644 --- a/pkg/utils/grpcutil/grpcutil.go +++ b/pkg/utils/grpcutil/grpcutil.go @@ -23,10 +23,6 @@ import ( "strings" "time" - "github.com/pingcap/errors" - "github.com/pingcap/log" - "github.com/tikv/pd/pkg/errs" - "github.com/tikv/pd/pkg/utils/logutil" "go.etcd.io/etcd/client/pkg/v3/transport" "go.uber.org/zap" "google.golang.org/grpc" @@ -35,6 +31,12 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" + + "github.com/pingcap/errors" + "github.com/pingcap/log" + + "github.com/tikv/pd/pkg/errs" + "github.com/tikv/pd/pkg/utils/logutil" ) const ( diff --git a/pkg/utils/grpcutil/grpcutil_test.go b/pkg/utils/grpcutil/grpcutil_test.go index fbcfe59f02c..db77a2e4002 100644 --- a/pkg/utils/grpcutil/grpcutil_test.go +++ b/pkg/utils/grpcutil/grpcutil_test.go @@ -7,10 +7,12 @@ import ( "path/filepath" "testing" - "github.com/pingcap/errors" "github.com/stretchr/testify/require" - "github.com/tikv/pd/pkg/errs" "google.golang.org/grpc/metadata" + + "github.com/pingcap/errors" + + "github.com/tikv/pd/pkg/errs" ) var ( diff --git a/pkg/utils/logutil/log.go b/pkg/utils/logutil/log.go index 4854fd7ac40..1620f9e3b70 100644 --- a/pkg/utils/logutil/log.go +++ b/pkg/utils/logutil/log.go @@ -21,10 +21,12 @@ import ( "strings" "sync/atomic" - "github.com/pingcap/log" - "github.com/tikv/pd/pkg/errs" "go.uber.org/zap" "go.uber.org/zap/zapcore" + + "github.com/pingcap/log" + + "github.com/tikv/pd/pkg/errs" ) // FileLogConfig serializes file log related config in toml/json. diff --git a/pkg/utils/metricutil/metricutil.go b/pkg/utils/metricutil/metricutil.go index 0d73c7678a8..32583248d5b 100644 --- a/pkg/utils/metricutil/metricutil.go +++ b/pkg/utils/metricutil/metricutil.go @@ -19,9 +19,11 @@ import ( "time" "unicode" - "github.com/pingcap/log" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/push" + + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/typeutil" diff --git a/pkg/utils/metricutil/metricutil_test.go b/pkg/utils/metricutil/metricutil_test.go index a5c183abc20..33f322d516b 100644 --- a/pkg/utils/metricutil/metricutil_test.go +++ b/pkg/utils/metricutil/metricutil_test.go @@ -19,6 +19,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/typeutil" ) diff --git a/pkg/utils/operatorutil/operator_check.go b/pkg/utils/operatorutil/operator_check.go index 78b9e9d9bab..4e0d4332a45 100644 --- a/pkg/utils/operatorutil/operator_check.go +++ b/pkg/utils/operatorutil/operator_check.go @@ -16,6 +16,7 @@ package operatorutil import ( "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/schedule/operator" ) diff --git a/pkg/utils/tempurl/check_env_linux.go b/pkg/utils/tempurl/check_env_linux.go index 58f902f4bb7..7e3dffc105b 100644 --- a/pkg/utils/tempurl/check_env_linux.go +++ b/pkg/utils/tempurl/check_env_linux.go @@ -18,7 +18,9 @@ package tempurl import ( "github.com/cakturk/go-netstat/netstat" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" ) diff --git a/pkg/utils/tempurl/tempurl.go b/pkg/utils/tempurl/tempurl.go index fae6f90af91..4984bb57b23 100644 --- a/pkg/utils/tempurl/tempurl.go +++ b/pkg/utils/tempurl/tempurl.go @@ -23,6 +23,7 @@ import ( "time" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/syncutil" ) diff --git a/pkg/utils/testutil/api_check.go b/pkg/utils/testutil/api_check.go index 0b714204500..3c5ffbdbe1e 100644 --- a/pkg/utils/testutil/api_check.go +++ b/pkg/utils/testutil/api_check.go @@ -20,6 +20,7 @@ import ( "net/http" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/apiutil" ) diff --git a/pkg/utils/testutil/testutil.go b/pkg/utils/testutil/testutil.go index 363b3f14aef..89e706b6b63 100644 --- a/pkg/utils/testutil/testutil.go +++ b/pkg/utils/testutil/testutil.go @@ -21,11 +21,12 @@ import ( "sync" "time" - "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/pingcap/log" "github.com/stretchr/testify/require" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + + "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/pingcap/log" ) const ( diff --git a/pkg/utils/tsoutil/tso_dispatcher.go b/pkg/utils/tsoutil/tso_dispatcher.go index 86afe75e6c5..be7d4fa6d83 100644 --- a/pkg/utils/tsoutil/tso_dispatcher.go +++ b/pkg/utils/tsoutil/tso_dispatcher.go @@ -20,15 +20,17 @@ import ( "sync" "time" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" + "google.golang.org/grpc" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/timerutil" - "go.uber.org/zap" - "google.golang.org/grpc" ) const ( diff --git a/pkg/utils/tsoutil/tso_proto_factory.go b/pkg/utils/tsoutil/tso_proto_factory.go index 9d8c0cfdb76..075a7024e98 100644 --- a/pkg/utils/tsoutil/tso_proto_factory.go +++ b/pkg/utils/tsoutil/tso_proto_factory.go @@ -17,10 +17,12 @@ package tsoutil import ( "context" + "google.golang.org/grpc" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/tsopb" + "github.com/tikv/pd/pkg/utils/grpcutil" - "google.golang.org/grpc" ) // ProtoFactory is the abstract factory for creating tso related data structures defined in the grpc service diff --git a/pkg/utils/tsoutil/tso_request.go b/pkg/utils/tsoutil/tso_request.go index d01247aa4b0..8a1a42a9d00 100644 --- a/pkg/utils/tsoutil/tso_request.go +++ b/pkg/utils/tsoutil/tso_request.go @@ -15,10 +15,12 @@ package tsoutil import ( + "google.golang.org/grpc" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/tsopb" + "github.com/tikv/pd/pkg/mcs/utils/constant" - "google.golang.org/grpc" ) // Request is an interface wrapping tsopb.TsoRequest and pdpb.TsoRequest so diff --git a/pkg/utils/typeutil/size.go b/pkg/utils/typeutil/size.go index c088ca73e59..1356cef3588 100644 --- a/pkg/utils/typeutil/size.go +++ b/pkg/utils/typeutil/size.go @@ -18,6 +18,7 @@ import ( "strconv" "github.com/docker/go-units" + "github.com/pingcap/errors" ) diff --git a/pkg/versioninfo/feature.go b/pkg/versioninfo/feature.go index 21ad56e8585..24aed22dc9d 100644 --- a/pkg/versioninfo/feature.go +++ b/pkg/versioninfo/feature.go @@ -16,9 +16,11 @@ package versioninfo import ( "github.com/coreos/go-semver/semver" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" - "go.uber.org/zap" ) // Feature supported features. diff --git a/pkg/versioninfo/versioninfo.go b/pkg/versioninfo/versioninfo.go index d6f4738d786..a6d7e910fb5 100644 --- a/pkg/versioninfo/versioninfo.go +++ b/pkg/versioninfo/versioninfo.go @@ -19,9 +19,11 @@ import ( "strings" "github.com/coreos/go-semver/semver" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" - "go.uber.org/zap" ) // Status is the status of PD server. diff --git a/plugin/scheduler_example/evict_leader.go b/plugin/scheduler_example/evict_leader.go index eb976edf851..4e0e700e8ce 100644 --- a/plugin/scheduler_example/evict_leader.go +++ b/plugin/scheduler_example/evict_leader.go @@ -20,8 +20,11 @@ import ( "strconv" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/errs" @@ -34,7 +37,6 @@ import ( "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/syncutil" - "github.com/unrolled/render" ) const ( diff --git a/server/api/admin.go b/server/api/admin.go index 24b9feaea75..434508c98df 100644 --- a/server/api/admin.go +++ b/server/api/admin.go @@ -22,14 +22,16 @@ import ( "strconv" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" - "go.uber.org/zap" ) type adminHandler struct { diff --git a/server/api/admin_test.go b/server/api/admin_test.go index 4995c57619b..029ddce87cc 100644 --- a/server/api/admin_test.go +++ b/server/api/admin_test.go @@ -23,9 +23,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/replication" "github.com/tikv/pd/pkg/utils/apiutil" diff --git a/server/api/checker.go b/server/api/checker.go index 709e641c37b..adf6f7c0ccc 100644 --- a/server/api/checker.go +++ b/server/api/checker.go @@ -18,9 +18,10 @@ import ( "net/http" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type checkerHandler struct { diff --git a/server/api/cluster.go b/server/api/cluster.go index 2c29101dd2d..e6c4954ff43 100644 --- a/server/api/cluster.go +++ b/server/api/cluster.go @@ -17,8 +17,9 @@ package api import ( "net/http" - "github.com/tikv/pd/server" "github.com/unrolled/render" + + "github.com/tikv/pd/server" ) type clusterHandler struct { diff --git a/server/api/cluster_test.go b/server/api/cluster_test.go index 0197489ecad..48854ac3fe8 100644 --- a/server/api/cluster_test.go +++ b/server/api/cluster_test.go @@ -19,8 +19,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + sc "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/schedule/placement" tu "github.com/tikv/pd/pkg/utils/testutil" diff --git a/server/api/config.go b/server/api/config.go index 511f47284a9..3eda889507f 100644 --- a/server/api/config.go +++ b/server/api/config.go @@ -24,9 +24,12 @@ import ( "strings" "time" + "github.com/unrolled/render" + "github.com/pingcap/errcode" "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" sc "github.com/tikv/pd/pkg/schedule/config" @@ -36,7 +39,6 @@ import ( "github.com/tikv/pd/pkg/utils/reflectutil" "github.com/tikv/pd/server" "github.com/tikv/pd/server/config" - "github.com/unrolled/render" ) // This line is to ensure the package `sc` could always be imported so that diff --git a/server/api/diagnostic.go b/server/api/diagnostic.go index 23016519dee..8df7368f074 100644 --- a/server/api/diagnostic.go +++ b/server/api/diagnostic.go @@ -18,8 +18,9 @@ import ( "net/http" "github.com/gorilla/mux" - "github.com/tikv/pd/server" "github.com/unrolled/render" + + "github.com/tikv/pd/server" ) type diagnosticHandler struct { diff --git a/server/api/diagnostic_test.go b/server/api/diagnostic_test.go index c85d9a45369..87f652d3a13 100644 --- a/server/api/diagnostic_test.go +++ b/server/api/diagnostic_test.go @@ -21,8 +21,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/schedulers" "github.com/tikv/pd/pkg/schedule/types" diff --git a/server/api/etcd_api_test.go b/server/api/etcd_api_test.go index cec4e6369e5..5dba77de09d 100644 --- a/server/api/etcd_api_test.go +++ b/server/api/etcd_api_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/stretchr/testify/require" + tu "github.com/tikv/pd/pkg/utils/testutil" ) diff --git a/server/api/health.go b/server/api/health.go index 93f95e8745d..dcfc21175c3 100644 --- a/server/api/health.go +++ b/server/api/health.go @@ -17,9 +17,10 @@ package api import ( "net/http" + "github.com/unrolled/render" + "github.com/tikv/pd/server" "github.com/tikv/pd/server/cluster" - "github.com/unrolled/render" ) type healthHandler struct { diff --git a/server/api/health_test.go b/server/api/health_test.go index 89a9627bc37..40a781a6e60 100644 --- a/server/api/health_test.go +++ b/server/api/health_test.go @@ -21,6 +21,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/server" "github.com/tikv/pd/server/config" ) diff --git a/server/api/hot_status.go b/server/api/hot_status.go index e4dbf96b904..07b3c165480 100644 --- a/server/api/hot_status.go +++ b/server/api/hot_status.go @@ -21,9 +21,10 @@ import ( "net/http" "strconv" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/statistics/utils" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type hotStatusHandler struct { diff --git a/server/api/hot_status_test.go b/server/api/hot_status_test.go index 1ffb9dd787f..a18b64f1e98 100644 --- a/server/api/hot_status_test.go +++ b/server/api/hot_status_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/syndtr/goleveldb/leveldb" + "github.com/tikv/pd/pkg/schedule/handler" "github.com/tikv/pd/pkg/storage" "github.com/tikv/pd/pkg/storage/kv" diff --git a/server/api/label.go b/server/api/label.go index ead6b30ae26..58647e2a592 100644 --- a/server/api/label.go +++ b/server/api/label.go @@ -19,12 +19,14 @@ import ( "regexp" "strings" + "github.com/unrolled/render" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/response" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type labelsHandler struct { diff --git a/server/api/label_test.go b/server/api/label_test.go index 70e4ab80066..92a59302753 100644 --- a/server/api/label_test.go +++ b/server/api/label_test.go @@ -19,9 +19,11 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/suite" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/response" "github.com/tikv/pd/pkg/utils/keypath" diff --git a/server/api/log.go b/server/api/log.go index 3359e70b115..6c2182694c1 100644 --- a/server/api/log.go +++ b/server/api/log.go @@ -19,10 +19,12 @@ import ( "io" "net/http" + "github.com/unrolled/render" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type logHandler struct { diff --git a/server/api/log_test.go b/server/api/log_test.go index 2478f6f4e54..641d873192b 100644 --- a/server/api/log_test.go +++ b/server/api/log_test.go @@ -19,8 +19,10 @@ import ( "fmt" "testing" - "github.com/pingcap/log" "github.com/stretchr/testify/suite" + + "github.com/pingcap/log" + tu "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server" ) diff --git a/server/api/member.go b/server/api/member.go index 5161322463a..e9d46459a91 100644 --- a/server/api/member.go +++ b/server/api/member.go @@ -21,16 +21,18 @@ import ( "strconv" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/server" - "github.com/unrolled/render" - "go.uber.org/zap" ) type memberHandler struct { diff --git a/server/api/member_test.go b/server/api/member_test.go index b56e84b2a1a..92fb7970f0d 100644 --- a/server/api/member_test.go +++ b/server/api/member_test.go @@ -24,13 +24,15 @@ import ( "strings" "testing" - "github.com/pingcap/kvproto/pkg/pdpb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + clientv3 "go.etcd.io/etcd/client/v3" + + "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server" "github.com/tikv/pd/server/config" - clientv3 "go.etcd.io/etcd/client/v3" ) type memberTestSuite struct { diff --git a/server/api/middleware.go b/server/api/middleware.go index fd0d81412ea..818d0d84e1d 100644 --- a/server/api/middleware.go +++ b/server/api/middleware.go @@ -19,14 +19,16 @@ import ( "net/http" "time" + "github.com/unrolled/render" + "github.com/urfave/negroni" + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/audit" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/requestutil" "github.com/tikv/pd/server" "github.com/tikv/pd/server/cluster" - "github.com/unrolled/render" - "github.com/urfave/negroni" ) // serviceMiddlewareBuilder is used to build service middleware for HTTP api diff --git a/server/api/min_resolved_ts.go b/server/api/min_resolved_ts.go index 1edf924370f..584eb649db7 100644 --- a/server/api/min_resolved_ts.go +++ b/server/api/min_resolved_ts.go @@ -20,9 +20,10 @@ import ( "strings" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type minResolvedTSHandler struct { diff --git a/server/api/min_resolved_ts_test.go b/server/api/min_resolved_ts_test.go index 88c01602eab..f999af3fe56 100644 --- a/server/api/min_resolved_ts_test.go +++ b/server/api/min_resolved_ts_test.go @@ -22,9 +22,11 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/testutil" diff --git a/server/api/operator.go b/server/api/operator.go index c2529240804..6bcb0699d7b 100644 --- a/server/api/operator.go +++ b/server/api/operator.go @@ -20,10 +20,11 @@ import ( "time" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type operatorHandler struct { diff --git a/server/api/plugin_disable.go b/server/api/plugin_disable.go index 596cddac5d7..ea7df0577ea 100644 --- a/server/api/plugin_disable.go +++ b/server/api/plugin_disable.go @@ -20,8 +20,9 @@ package api import ( "net/http" - "github.com/tikv/pd/server" "github.com/unrolled/render" + + "github.com/tikv/pd/server" ) type pluginHandler struct{} diff --git a/server/api/pprof.go b/server/api/pprof.go index ee4398c60b2..071dd1b2a4b 100644 --- a/server/api/pprof.go +++ b/server/api/pprof.go @@ -26,11 +26,13 @@ import ( "strconv" "time" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/versioninfo" "github.com/tikv/pd/server" - "github.com/unrolled/render" - "go.uber.org/zap" ) // pprofHandler pprof handler diff --git a/server/api/pprof_test.go b/server/api/pprof_test.go index b43feeab108..1bb1668e374 100644 --- a/server/api/pprof_test.go +++ b/server/api/pprof_test.go @@ -21,6 +21,7 @@ import ( "testing" "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server" ) diff --git a/server/api/region.go b/server/api/region.go index ae25d659544..afc32d2e762 100644 --- a/server/api/region.go +++ b/server/api/region.go @@ -24,7 +24,10 @@ import ( "strings" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/keyspace" @@ -33,7 +36,6 @@ import ( "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type regionHandler struct { diff --git a/server/api/region_label.go b/server/api/region_label.go index 7958bacd371..2fa6466d480 100644 --- a/server/api/region_label.go +++ b/server/api/region_label.go @@ -20,11 +20,12 @@ import ( "strconv" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/schedule/labeler" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type regionLabelHandler struct { diff --git a/server/api/region_label_test.go b/server/api/region_label_test.go index 1ed0997b8e7..a35f77be1cf 100644 --- a/server/api/region_label_test.go +++ b/server/api/region_label_test.go @@ -21,8 +21,10 @@ import ( "sort" "testing" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/schedule/labeler" tu "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server" diff --git a/server/api/region_test.go b/server/api/region_test.go index c73dc02587d..ae91b41ef5e 100644 --- a/server/api/region_test.go +++ b/server/api/region_test.go @@ -27,10 +27,12 @@ import ( "time" "github.com/docker/go-units" - "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/kvproto/pkg/pdpb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/response" "github.com/tikv/pd/pkg/utils/apiutil" diff --git a/server/api/replication_mode.go b/server/api/replication_mode.go index 4fe2ef5da09..2e5a92c2195 100644 --- a/server/api/replication_mode.go +++ b/server/api/replication_mode.go @@ -17,8 +17,9 @@ package api import ( "net/http" - "github.com/tikv/pd/server" "github.com/unrolled/render" + + "github.com/tikv/pd/server" ) type replicationModeHandler struct { diff --git a/server/api/router.go b/server/api/router.go index 6ea52304b63..fd999211542 100644 --- a/server/api/router.go +++ b/server/api/router.go @@ -22,13 +22,15 @@ import ( "strings" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/audit" "github.com/tikv/pd/pkg/ratelimit" "github.com/tikv/pd/pkg/tso" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) // enableFailPointAPI enable fail point API handler. diff --git a/server/api/rule.go b/server/api/rule.go index 27a95a08269..4bd062e92c9 100644 --- a/server/api/rule.go +++ b/server/api/rule.go @@ -22,11 +22,12 @@ import ( "net/url" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/schedule/placement" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type ruleHandler struct { diff --git a/server/api/scheduler.go b/server/api/scheduler.go index 8922a833a07..b2d18012c89 100644 --- a/server/api/scheduler.go +++ b/server/api/scheduler.go @@ -21,16 +21,18 @@ import ( "strings" "github.com/gorilla/mux" + "github.com/unrolled/render" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/slice" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" - "go.uber.org/zap" ) type schedulerHandler struct { diff --git a/server/api/server.go b/server/api/server.go index 8a58669de3b..1a744635e2d 100644 --- a/server/api/server.go +++ b/server/api/server.go @@ -20,13 +20,14 @@ import ( "strings" "github.com/gorilla/mux" + "github.com/urfave/negroni" + scheapi "github.com/tikv/pd/pkg/mcs/scheduling/server/apis/v1" tsoapi "github.com/tikv/pd/pkg/mcs/tso/server/apis/v1" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/apiutil/serverapi" "github.com/tikv/pd/server" - "github.com/urfave/negroni" ) const apiPrefix = "/pd" diff --git a/server/api/server_test.go b/server/api/server_test.go index f2ff4ffb452..9b99a6c32f8 100644 --- a/server/api/server_test.go +++ b/server/api/server_test.go @@ -23,11 +23,14 @@ import ( "sync" "testing" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "go.uber.org/goleak" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/assertutil" @@ -37,7 +40,6 @@ import ( "github.com/tikv/pd/pkg/versioninfo" "github.com/tikv/pd/server" "github.com/tikv/pd/server/config" - "go.uber.org/goleak" ) var ( diff --git a/server/api/service_gc_safepoint.go b/server/api/service_gc_safepoint.go index ca29f9c352f..ab3002d1297 100644 --- a/server/api/service_gc_safepoint.go +++ b/server/api/service_gc_safepoint.go @@ -19,9 +19,10 @@ import ( "time" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type serviceGCSafepointHandler struct { diff --git a/server/api/service_gc_safepoint_test.go b/server/api/service_gc_safepoint_test.go index 6325babd438..33f78570e2d 100644 --- a/server/api/service_gc_safepoint_test.go +++ b/server/api/service_gc_safepoint_test.go @@ -19,8 +19,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/testutil" diff --git a/server/api/service_middleware.go b/server/api/service_middleware.go index da40a79cbea..6f11fb58cf4 100644 --- a/server/api/service_middleware.go +++ b/server/api/service_middleware.go @@ -22,15 +22,16 @@ import ( "reflect" "strings" + "github.com/unrolled/render" + "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/ratelimit" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/jsonutil" "github.com/tikv/pd/pkg/utils/reflectutil" "github.com/tikv/pd/server" "github.com/tikv/pd/server/config" - - "github.com/unrolled/render" ) type serviceMiddlewareHandler struct { diff --git a/server/api/service_middleware_test.go b/server/api/service_middleware_test.go index 2599ccbfb54..b91f07560aa 100644 --- a/server/api/service_middleware_test.go +++ b/server/api/service_middleware_test.go @@ -20,8 +20,10 @@ import ( "net/http" "testing" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/ratelimit" tu "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server" diff --git a/server/api/stats.go b/server/api/stats.go index 5aa8fcb72a6..8672d562fd4 100644 --- a/server/api/stats.go +++ b/server/api/stats.go @@ -17,9 +17,10 @@ package api import ( "net/http" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/statistics" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type statsHandler struct { diff --git a/server/api/stats_test.go b/server/api/stats_test.go index 1485f9eb5af..9c219ea58fd 100644 --- a/server/api/stats_test.go +++ b/server/api/stats_test.go @@ -19,8 +19,10 @@ import ( "net/url" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/statistics" "github.com/tikv/pd/pkg/utils/apiutil" diff --git a/server/api/status.go b/server/api/status.go index e25f5da5287..3be84c3f598 100644 --- a/server/api/status.go +++ b/server/api/status.go @@ -17,9 +17,10 @@ package api import ( "net/http" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/versioninfo" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type statusHandler struct { diff --git a/server/api/status_test.go b/server/api/status_test.go index 5444fda77b4..f75259a7728 100644 --- a/server/api/status_test.go +++ b/server/api/status_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/versioninfo" ) diff --git a/server/api/store.go b/server/api/store.go index 1342645cdb9..fb3e9cfb964 100644 --- a/server/api/store.go +++ b/server/api/store.go @@ -23,10 +23,13 @@ import ( "time" "github.com/gorilla/mux" + "github.com/unrolled/render" + "github.com/pingcap/errcode" "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/response" @@ -34,7 +37,6 @@ import ( "github.com/tikv/pd/pkg/slice" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type storeHandler struct { diff --git a/server/api/store_test.go b/server/api/store_test.go index 47c7045ae02..dd0d1e1fe8b 100644 --- a/server/api/store_test.go +++ b/server/api/store_test.go @@ -25,10 +25,12 @@ import ( "time" "github.com/docker/go-units" - "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/kvproto/pkg/pdpb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/response" "github.com/tikv/pd/pkg/utils/keypath" diff --git a/server/api/trend.go b/server/api/trend.go index 6a32b875f89..74dc43c53b5 100644 --- a/server/api/trend.go +++ b/server/api/trend.go @@ -18,13 +18,14 @@ import ( "net/http" "time" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/response" "github.com/tikv/pd/pkg/statistics" "github.com/tikv/pd/pkg/statistics/utils" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) // Trend describes the cluster's schedule trend. diff --git a/server/api/trend_test.go b/server/api/trend_test.go index 4e93d0bea93..4e4a1be1f08 100644 --- a/server/api/trend_test.go +++ b/server/api/trend_test.go @@ -19,8 +19,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/operator" tu "github.com/tikv/pd/pkg/utils/testutil" diff --git a/server/api/tso.go b/server/api/tso.go index 95096257066..eca9dc7f8b4 100644 --- a/server/api/tso.go +++ b/server/api/tso.go @@ -17,8 +17,9 @@ package api import ( "net/http" - "github.com/tikv/pd/server" "github.com/unrolled/render" + + "github.com/tikv/pd/server" ) type tsoHandler struct { diff --git a/server/api/unsafe_operation.go b/server/api/unsafe_operation.go index dc41ec336e3..ec3da8a25be 100644 --- a/server/api/unsafe_operation.go +++ b/server/api/unsafe_operation.go @@ -17,10 +17,11 @@ package api import ( "net/http" + "github.com/unrolled/render" + "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/server" - "github.com/unrolled/render" ) type unsafeOperationHandler struct { diff --git a/server/api/unsafe_operation_test.go b/server/api/unsafe_operation_test.go index e708a93abfc..24cf9d7bbc3 100644 --- a/server/api/unsafe_operation_test.go +++ b/server/api/unsafe_operation_test.go @@ -19,8 +19,10 @@ import ( "fmt" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/unsaferecovery" tu "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server" diff --git a/server/api/version.go b/server/api/version.go index 99a8a7376e5..fdc07a8b417 100644 --- a/server/api/version.go +++ b/server/api/version.go @@ -17,8 +17,9 @@ package api import ( "net/http" - "github.com/tikv/pd/pkg/versioninfo" "github.com/unrolled/render" + + "github.com/tikv/pd/pkg/versioninfo" ) // NOTE: This type is exported by HTTP API. Please pay more attention when modifying it. diff --git a/server/api/version_test.go b/server/api/version_test.go index 46bc80537a6..5342b1d9ebb 100644 --- a/server/api/version_test.go +++ b/server/api/version_test.go @@ -22,8 +22,10 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/utils/assertutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server" diff --git a/server/apiv2/handlers/keyspace.go b/server/apiv2/handlers/keyspace.go index 89d0634ce8f..0245016734c 100644 --- a/server/apiv2/handlers/keyspace.go +++ b/server/apiv2/handlers/keyspace.go @@ -22,8 +22,10 @@ import ( "time" "github.com/gin-gonic/gin" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/keyspace" "github.com/tikv/pd/server" diff --git a/server/apiv2/handlers/micro_service.go b/server/apiv2/handlers/micro_service.go index fd44665530f..c7fa0dc94f2 100644 --- a/server/apiv2/handlers/micro_service.go +++ b/server/apiv2/handlers/micro_service.go @@ -18,6 +18,7 @@ import ( "net/http" "github.com/gin-gonic/gin" + "github.com/tikv/pd/pkg/mcs/discovery" "github.com/tikv/pd/server" "github.com/tikv/pd/server/apiv2/middlewares" diff --git a/server/apiv2/handlers/tso_keyspace_group.go b/server/apiv2/handlers/tso_keyspace_group.go index e99e8cf55a4..99a4e55c29f 100644 --- a/server/apiv2/handlers/tso_keyspace_group.go +++ b/server/apiv2/handlers/tso_keyspace_group.go @@ -20,7 +20,9 @@ import ( "strings" "github.com/gin-gonic/gin" + "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/slice" diff --git a/server/apiv2/middlewares/bootstrap_checker.go b/server/apiv2/middlewares/bootstrap_checker.go index 794316d3d0f..712cf71e491 100644 --- a/server/apiv2/middlewares/bootstrap_checker.go +++ b/server/apiv2/middlewares/bootstrap_checker.go @@ -18,6 +18,7 @@ import ( "net/http" "github.com/gin-gonic/gin" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/server" ) diff --git a/server/apiv2/middlewares/redirector.go b/server/apiv2/middlewares/redirector.go index 9c2c4081175..fb6b0496bec 100644 --- a/server/apiv2/middlewares/redirector.go +++ b/server/apiv2/middlewares/redirector.go @@ -19,11 +19,13 @@ import ( "net/url" "github.com/gin-gonic/gin" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" - "go.uber.org/zap" ) // Redirector is a middleware to redirect the request to the right place. diff --git a/server/apiv2/router.go b/server/apiv2/router.go index 781a1cca87b..612ba8932ff 100644 --- a/server/apiv2/router.go +++ b/server/apiv2/router.go @@ -19,6 +19,7 @@ import ( "net/http" "github.com/gin-gonic/gin" + "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/server" "github.com/tikv/pd/server/apiv2/handlers" diff --git a/server/cluster/cluster.go b/server/cluster/cluster.go index 10e9bf7ff1a..5ecd787956d 100644 --- a/server/cluster/cluster.go +++ b/server/cluster/cluster.go @@ -30,11 +30,15 @@ import ( "time" "github.com/coreos/go-semver/semver" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/cluster" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/storelimit" @@ -69,8 +73,6 @@ import ( "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/pkg/versioninfo" "github.com/tikv/pd/server/config" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) var ( diff --git a/server/cluster/cluster_test.go b/server/cluster/cluster_test.go index 99bb60b5558..11b5743fa13 100644 --- a/server/cluster/cluster_test.go +++ b/server/cluster/cluster_test.go @@ -27,13 +27,15 @@ import ( "time" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/eraftpb" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/cluster" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/constant" diff --git a/server/cluster/cluster_worker.go b/server/cluster/cluster_worker.go index c14ceff2153..c24b509549a 100644 --- a/server/cluster/cluster_worker.go +++ b/server/cluster/cluster_worker.go @@ -17,10 +17,13 @@ package cluster import ( "bytes" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" @@ -30,7 +33,6 @@ import ( "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/pkg/versioninfo" - "go.uber.org/zap" ) // HandleRegionHeartbeat processes RegionInfo reports from client. diff --git a/server/cluster/cluster_worker_test.go b/server/cluster/cluster_worker_test.go index afc979e2b97..150afc0c8a9 100644 --- a/server/cluster/cluster_worker_test.go +++ b/server/cluster/cluster_worker_test.go @@ -18,9 +18,11 @@ import ( "context" "testing" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/mock/mockid" "github.com/tikv/pd/pkg/storage" ) diff --git a/server/cluster/scheduling_controller.go b/server/cluster/scheduling_controller.go index b182410c016..fd9c590ef68 100644 --- a/server/cluster/scheduling_controller.go +++ b/server/cluster/scheduling_controller.go @@ -22,6 +22,7 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule" "github.com/tikv/pd/pkg/schedule/checker" diff --git a/server/config/config.go b/server/config/config.go index a5183f119f2..282b5264fe9 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -28,9 +28,14 @@ import ( "github.com/BurntSushi/toml" "github.com/coreos/go-semver/semver" "github.com/docker/go-units" + "github.com/spf13/pflag" + "go.etcd.io/etcd/client/pkg/v3/transport" + "go.etcd.io/etcd/server/v3/embed" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/spf13/pflag" + "github.com/tikv/pd/pkg/errs" rm "github.com/tikv/pd/pkg/mcs/resourcemanager/server" sc "github.com/tikv/pd/pkg/schedule/config" @@ -39,9 +44,6 @@ import ( "github.com/tikv/pd/pkg/utils/metricutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/pkg/versioninfo" - "go.etcd.io/etcd/client/pkg/v3/transport" - "go.etcd.io/etcd/server/v3/embed" - "go.uber.org/zap" ) // Config is the pd server configuration. diff --git a/server/config/config_test.go b/server/config/config_test.go index 78d6d25b73e..cd9447a5824 100644 --- a/server/config/config_test.go +++ b/server/config/config_test.go @@ -26,6 +26,7 @@ import ( "github.com/BurntSushi/toml" "github.com/spf13/pflag" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/ratelimit" sc "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/storage" diff --git a/server/config/persist_options.go b/server/config/persist_options.go index c426e9d2420..59d42383743 100644 --- a/server/config/persist_options.go +++ b/server/config/persist_options.go @@ -25,10 +25,14 @@ import ( "unsafe" "github.com/coreos/go-semver/semver" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core/constant" "github.com/tikv/pd/pkg/core/storelimit" @@ -38,8 +42,6 @@ import ( "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/typeutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // PersistOptions wraps all configurations that need to persist to storage and diff --git a/server/config/service_middleware_persist_options.go b/server/config/service_middleware_persist_options.go index cd67c9dd1ac..ae4c0ef9b7a 100644 --- a/server/config/service_middleware_persist_options.go +++ b/server/config/service_middleware_persist_options.go @@ -19,6 +19,7 @@ import ( "sync/atomic" "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/storage/endpoint" ) diff --git a/server/config/util.go b/server/config/util.go index 2f25e711cc7..f2bc39459fd 100644 --- a/server/config/util.go +++ b/server/config/util.go @@ -19,6 +19,7 @@ import ( "strings" "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/errs" ) diff --git a/server/forward.go b/server/forward.go index 674b3e008b6..b3d0d63c81b 100644 --- a/server/forward.go +++ b/server/forward.go @@ -20,12 +20,18 @@ import ( "strings" "time" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/schedulingpb" "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/grpcutil" @@ -33,10 +39,6 @@ import ( "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/pkg/utils/tsoutil" "github.com/tikv/pd/server/cluster" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) func forwardTSORequest( diff --git a/server/gc_service.go b/server/gc_service.go index 114482fdd39..e9e52333905 100644 --- a/server/gc_service.go +++ b/server/gc_service.go @@ -22,16 +22,18 @@ import ( "path" "strings" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "google.golang.org/grpc" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/tsoutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "google.golang.org/grpc" ) // GetGCSafePointV2 return gc safe point for the given keyspace. diff --git a/server/grpc_service.go b/server/grpc_service.go index de74916900e..d10421e87d7 100644 --- a/server/grpc_service.go +++ b/server/grpc_service.go @@ -28,6 +28,13 @@ import ( "sync/atomic" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/multierr" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" @@ -35,6 +42,7 @@ import ( "github.com/pingcap/kvproto/pkg/schedulingpb" "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/mcs/utils/constant" @@ -47,12 +55,6 @@ import ( "github.com/tikv/pd/pkg/utils/tsoutil" "github.com/tikv/pd/pkg/versioninfo" "github.com/tikv/pd/server/cluster" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/multierr" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) const ( diff --git a/server/handler.go b/server/handler.go index 2ecf7763ce2..9fa0ca6a5c5 100644 --- a/server/handler.go +++ b/server/handler.go @@ -22,8 +22,11 @@ import ( "path/filepath" "time" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/encryption" @@ -42,7 +45,6 @@ import ( "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/server/cluster" "github.com/tikv/pd/server/config" - "go.uber.org/zap" ) // SchedulerConfigHandlerPath is the api router path of the schedule config handler. diff --git a/server/join/join.go b/server/join/join.go index e77675f2196..26b6f98667d 100644 --- a/server/join/join.go +++ b/server/join/join.go @@ -21,15 +21,17 @@ import ( "strings" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/embed" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/server/config" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/embed" - "go.uber.org/zap" ) const ( diff --git a/server/join/join_test.go b/server/join/join_test.go index edbcb7a3077..b89a2ed10ac 100644 --- a/server/join/join_test.go +++ b/server/join/join_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/assertutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server" diff --git a/server/keyspace_service.go b/server/keyspace_service.go index 967457198a9..e110742aa45 100644 --- a/server/keyspace_service.go +++ b/server/keyspace_service.go @@ -20,13 +20,15 @@ import ( "time" "github.com/gogo/protobuf/proto" + "go.etcd.io/etcd/api/v3/mvccpb" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/keyspace" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" ) // KeyspaceServer wraps GrpcServer to provide keyspace service. diff --git a/server/server.go b/server/server.go index 7df3da153ba..a2cc32db9dd 100644 --- a/server/server.go +++ b/server/server.go @@ -32,6 +32,13 @@ import ( "github.com/coreos/go-semver/semver" "github.com/gogo/protobuf/proto" "github.com/gorilla/mux" + "go.etcd.io/etcd/api/v3/mvccpb" + etcdtypes "go.etcd.io/etcd/client/pkg/v3/types" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/embed" + "go.uber.org/zap" + "google.golang.org/grpc" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/diagnosticspb" @@ -41,6 +48,7 @@ import ( "github.com/pingcap/kvproto/pkg/tsopb" "github.com/pingcap/log" "github.com/pingcap/sysutil" + "github.com/tikv/pd/pkg/audit" bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/cgroup" @@ -53,8 +61,6 @@ import ( ms_server "github.com/tikv/pd/pkg/mcs/metastorage/server" "github.com/tikv/pd/pkg/mcs/registry" rm_server "github.com/tikv/pd/pkg/mcs/resourcemanager/server" - _ "github.com/tikv/pd/pkg/mcs/resourcemanager/server/apis/v1" // init API group - _ "github.com/tikv/pd/pkg/mcs/tso/server/apis/v1" // init tso API group "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/member" "github.com/tikv/pd/pkg/ratelimit" @@ -80,12 +86,9 @@ import ( "github.com/tikv/pd/pkg/versioninfo" "github.com/tikv/pd/server/cluster" "github.com/tikv/pd/server/config" - "go.etcd.io/etcd/api/v3/mvccpb" - etcdtypes "go.etcd.io/etcd/client/pkg/v3/types" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/embed" - "go.uber.org/zap" - "google.golang.org/grpc" + + _ "github.com/tikv/pd/pkg/mcs/resourcemanager/server/apis/v1" // init API group + _ "github.com/tikv/pd/pkg/mcs/tso/server/apis/v1" // init tso API group ) const ( diff --git a/server/server_test.go b/server/server_test.go index 7dd91b9f61f..23da2078cb2 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -25,15 +25,16 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + etcdtypes "go.etcd.io/etcd/client/pkg/v3/types" + "go.etcd.io/etcd/server/v3/embed" + "go.uber.org/goleak" + "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/assertutil" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server/config" - etcdtypes "go.etcd.io/etcd/client/pkg/v3/types" - "go.etcd.io/etcd/server/v3/embed" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/server/testutil.go b/server/testutil.go index 2c844bf3d6b..d8bb9bb1cd9 100644 --- a/server/testutil.go +++ b/server/testutil.go @@ -23,8 +23,11 @@ import ( "sync" "time" - "github.com/pingcap/log" "github.com/stretchr/testify/require" + "go.etcd.io/etcd/server/v3/embed" + + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/schedule/schedulers" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/assertutil" @@ -33,7 +36,6 @@ import ( "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/server/config" - "go.etcd.io/etcd/server/v3/embed" ) // NewTestServer creates a pd server for testing. diff --git a/server/util.go b/server/util.go index 0b396b0f5df..1764e4e9850 100644 --- a/server/util.go +++ b/server/util.go @@ -22,16 +22,18 @@ import ( "github.com/coreos/go-semver/semver" "github.com/gorilla/mux" + "github.com/urfave/negroni" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/versioninfo" "github.com/tikv/pd/server/config" - "github.com/urfave/negroni" - "go.uber.org/zap" ) // CheckAndGetPDVersion checks and returns the PD version. diff --git a/tests/autoscaling/autoscaling_test.go b/tests/autoscaling/autoscaling_test.go index 10d10378323..c00bc00afe0 100644 --- a/tests/autoscaling/autoscaling_test.go +++ b/tests/autoscaling/autoscaling_test.go @@ -21,9 +21,10 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.uber.org/goleak" + "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/cluster.go b/tests/cluster.go index 21807d2aadc..a4f445155e1 100644 --- a/tests/cluster.go +++ b/tests/cluster.go @@ -22,10 +22,13 @@ import ( "time" "github.com/coreos/go-semver/semver" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/autoscaling" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/dashboard" @@ -46,7 +49,6 @@ import ( "github.com/tikv/pd/server/cluster" "github.com/tikv/pd/server/config" "github.com/tikv/pd/server/join" - clientv3 "go.etcd.io/etcd/client/v3" ) // TestServer states. diff --git a/tests/compatibility/version_upgrade_test.go b/tests/compatibility/version_upgrade_test.go index 27eb07b0da2..7b5fd05071b 100644 --- a/tests/compatibility/version_upgrade_test.go +++ b/tests/compatibility/version_upgrade_test.go @@ -19,10 +19,12 @@ import ( "testing" "github.com/coreos/go-semver/semver" + "github.com/stretchr/testify/require" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/server" "github.com/tikv/pd/tests" ) diff --git a/tests/config.go b/tests/config.go index fcda28d4a3d..c1cb366dfa9 100644 --- a/tests/config.go +++ b/tests/config.go @@ -20,6 +20,7 @@ import ( "strings" "github.com/spf13/pflag" + "github.com/tikv/pd/pkg/utils/tempurl" "github.com/tikv/pd/server/config" ) diff --git a/tests/dashboard/race_test.go b/tests/dashboard/race_test.go index ad2d673f40d..6d117760f8f 100644 --- a/tests/dashboard/race_test.go +++ b/tests/dashboard/race_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/dashboard" "github.com/tikv/pd/tests" ) diff --git a/tests/dashboard/service_test.go b/tests/dashboard/service_test.go index e689b1d4662..2c29230f787 100644 --- a/tests/dashboard/service_test.go +++ b/tests/dashboard/service_test.go @@ -26,11 +26,12 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/goleak" + "github.com/tikv/pd/pkg/dashboard" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/integrations/client/client_test.go b/tests/integrations/client/client_test.go index 0462a6d9ea0..9ba63f0c83f 100644 --- a/tests/integrations/client/client_test.go +++ b/tests/integrations/client/client_test.go @@ -31,12 +31,18 @@ import ( "time" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/goleak" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/meta_storagepb" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/clients/router" "github.com/tikv/pd/client/opt" @@ -56,10 +62,6 @@ import ( "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" "github.com/tikv/pd/tests/integrations/mcs" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/goleak" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) const ( diff --git a/tests/integrations/client/client_tls_test.go b/tests/integrations/client/client_tls_test.go index fb76b4a0be1..40a36205de0 100644 --- a/tests/integrations/client/client_tls_test.go +++ b/tests/integrations/client/client_tls_test.go @@ -27,6 +27,9 @@ import ( "time" "github.com/stretchr/testify/require" + "go.etcd.io/etcd/client/pkg/v3/transport" + "google.golang.org/grpc" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/opt" "github.com/tikv/pd/client/pkg/caller" @@ -34,8 +37,6 @@ import ( "github.com/tikv/pd/pkg/utils/netutil" "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" - "go.etcd.io/etcd/client/pkg/v3/transport" - "google.golang.org/grpc" ) var certScript = strings.Join([]string{".", "cert_opt.sh"}, string(filepath.Separator)) diff --git a/tests/integrations/client/gc_client_test.go b/tests/integrations/client/gc_client_test.go index 17db7345b81..0ea0c3daf19 100644 --- a/tests/integrations/client/gc_client_test.go +++ b/tests/integrations/client/gc_client_test.go @@ -20,20 +20,22 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "google.golang.org/grpc" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/pkg/caller" "github.com/tikv/pd/pkg/utils/assertutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "google.golang.org/grpc" ) // gcClientTestReceiver is the pdpb.PD_WatchGCSafePointV2Server mock for testing. diff --git a/tests/integrations/client/global_config_test.go b/tests/integrations/client/global_config_test.go index 81aac43a293..04ef3992a2f 100644 --- a/tests/integrations/client/global_config_test.go +++ b/tests/integrations/client/global_config_test.go @@ -21,19 +21,20 @@ import ( "testing" "time" - pd "github.com/tikv/pd/client" - "github.com/tikv/pd/client/pkg/caller" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "go.uber.org/zap" + "google.golang.org/grpc" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + + pd "github.com/tikv/pd/client" + "github.com/tikv/pd/client/pkg/caller" "github.com/tikv/pd/pkg/utils/assertutil" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server" - "go.uber.org/zap" - "google.golang.org/grpc" ) const globalConfigPath = "/global/config/" diff --git a/tests/integrations/client/http_client_test.go b/tests/integrations/client/http_client_test.go index d0ff81f9fad..0cbf12261f3 100644 --- a/tests/integrations/client/http_client_test.go +++ b/tests/integrations/client/http_client_test.go @@ -25,13 +25,15 @@ import ( "testing" "time" - "github.com/pingcap/errors" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/errors" + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/metapb" + pd "github.com/tikv/pd/client/http" "github.com/tikv/pd/client/pkg/retry" "github.com/tikv/pd/pkg/core" diff --git a/tests/integrations/client/keyspace_test.go b/tests/integrations/client/keyspace_test.go index 841859bbb80..3c976ebbc57 100644 --- a/tests/integrations/client/keyspace_test.go +++ b/tests/integrations/client/keyspace_test.go @@ -19,8 +19,10 @@ import ( "math" "time" - "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/pkg/keyspace" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/slice" diff --git a/tests/integrations/mcs/discovery/register_test.go b/tests/integrations/mcs/discovery/register_test.go index 147e16530b7..da6fa158307 100644 --- a/tests/integrations/mcs/discovery/register_test.go +++ b/tests/integrations/mcs/discovery/register_test.go @@ -21,13 +21,14 @@ import ( "time" "github.com/stretchr/testify/suite" + "go.uber.org/goleak" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/mcs/discovery" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/tempurl" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/integrations/mcs/keyspace/tso_keyspace_group_test.go b/tests/integrations/mcs/keyspace/tso_keyspace_group_test.go index c6b6070fda5..44347b4757d 100644 --- a/tests/integrations/mcs/keyspace/tso_keyspace_group_test.go +++ b/tests/integrations/mcs/keyspace/tso_keyspace_group_test.go @@ -24,9 +24,11 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/storage/endpoint" diff --git a/tests/integrations/mcs/members/member_test.go b/tests/integrations/mcs/members/member_test.go index e1953de4e62..28275849073 100644 --- a/tests/integrations/mcs/members/member_test.go +++ b/tests/integrations/mcs/members/member_test.go @@ -24,9 +24,11 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + pdClient "github.com/tikv/pd/client/http" bs "github.com/tikv/pd/pkg/basicserver" tso "github.com/tikv/pd/pkg/mcs/tso/server" diff --git a/tests/integrations/mcs/resourcemanager/resource_manager_test.go b/tests/integrations/mcs/resourcemanager/resource_manager_test.go index 22cb6b64c0a..2eb66df2e2b 100644 --- a/tests/integrations/mcs/resourcemanager/resource_manager_test.go +++ b/tests/integrations/mcs/resourcemanager/resource_manager_test.go @@ -26,11 +26,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "go.uber.org/goleak" + "go.uber.org/zap" + "github.com/pingcap/failpoint" rmpb "github.com/pingcap/kvproto/pkg/resource_manager" "github.com/pingcap/log" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/pkg/caller" "github.com/tikv/pd/client/resource_group/controller" @@ -39,8 +43,6 @@ import ( "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/tests" - "go.uber.org/goleak" - "go.uber.org/zap" // Register Service _ "github.com/tikv/pd/pkg/mcs/registry" diff --git a/tests/integrations/mcs/scheduling/api_test.go b/tests/integrations/mcs/scheduling/api_test.go index f3e7f235018..14b867a587d 100644 --- a/tests/integrations/mcs/scheduling/api_test.go +++ b/tests/integrations/mcs/scheduling/api_test.go @@ -10,11 +10,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" - _ "github.com/tikv/pd/pkg/mcs/scheduling/server/apis/v1" "github.com/tikv/pd/pkg/mcs/scheduling/server/config" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/schedule/handler" @@ -27,6 +28,8 @@ import ( "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/versioninfo" "github.com/tikv/pd/tests" + + _ "github.com/tikv/pd/pkg/mcs/scheduling/server/apis/v1" ) type apiTestSuite struct { diff --git a/tests/integrations/mcs/scheduling/config_test.go b/tests/integrations/mcs/scheduling/config_test.go index 6a41ad0823e..d7d200814bb 100644 --- a/tests/integrations/mcs/scheduling/config_test.go +++ b/tests/integrations/mcs/scheduling/config_test.go @@ -20,9 +20,11 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/cache" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mcs/scheduling/server/config" diff --git a/tests/integrations/mcs/scheduling/meta_test.go b/tests/integrations/mcs/scheduling/meta_test.go index 0798e9f129e..4e0d5249fdb 100644 --- a/tests/integrations/mcs/scheduling/meta_test.go +++ b/tests/integrations/mcs/scheduling/meta_test.go @@ -20,9 +20,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/mcs/scheduling/server/meta" "github.com/tikv/pd/pkg/utils/testutil" diff --git a/tests/integrations/mcs/scheduling/rule_test.go b/tests/integrations/mcs/scheduling/rule_test.go index e8b394ec075..a137619afbf 100644 --- a/tests/integrations/mcs/scheduling/rule_test.go +++ b/tests/integrations/mcs/scheduling/rule_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/schedule/labeler" "github.com/tikv/pd/pkg/schedule/placement" "github.com/tikv/pd/pkg/utils/testutil" diff --git a/tests/integrations/mcs/scheduling/server_test.go b/tests/integrations/mcs/scheduling/server_test.go index 085b87afe86..d3850e4667c 100644 --- a/tests/integrations/mcs/scheduling/server_test.go +++ b/tests/integrations/mcs/scheduling/server_test.go @@ -23,11 +23,14 @@ import ( "time" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "go.uber.org/goleak" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/schedule/operator" @@ -37,7 +40,6 @@ import ( "github.com/tikv/pd/server" "github.com/tikv/pd/tests" "github.com/tikv/pd/tests/server/api" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/integrations/mcs/testutil.go b/tests/integrations/mcs/testutil.go index d9dc7def3d1..b605462c044 100644 --- a/tests/integrations/mcs/testutil.go +++ b/tests/integrations/mcs/testutil.go @@ -19,6 +19,7 @@ import ( "sync" "github.com/stretchr/testify/require" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/opt" "github.com/tikv/pd/client/pkg/caller" diff --git a/tests/integrations/mcs/tso/api_test.go b/tests/integrations/mcs/tso/api_test.go index 7abf1503bec..91614530ef1 100644 --- a/tests/integrations/mcs/tso/api_test.go +++ b/tests/integrations/mcs/tso/api_test.go @@ -24,9 +24,11 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + tso "github.com/tikv/pd/pkg/mcs/tso/server" apis "github.com/tikv/pd/pkg/mcs/tso/server/apis/v1" "github.com/tikv/pd/pkg/mcs/utils/constant" diff --git a/tests/integrations/mcs/tso/keyspace_group_manager_test.go b/tests/integrations/mcs/tso/keyspace_group_manager_test.go index fc90241eb81..2c19f6588e5 100644 --- a/tests/integrations/mcs/tso/keyspace_group_manager_test.go +++ b/tests/integrations/mcs/tso/keyspace_group_manager_test.go @@ -25,10 +25,12 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/pdpb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/pdpb" + pd "github.com/tikv/pd/client" clierrs "github.com/tikv/pd/client/errs" "github.com/tikv/pd/client/pkg/caller" diff --git a/tests/integrations/mcs/tso/proxy_test.go b/tests/integrations/mcs/tso/proxy_test.go index a15cbb1cd03..b564076c1f0 100644 --- a/tests/integrations/mcs/tso/proxy_test.go +++ b/tests/integrations/mcs/tso/proxy_test.go @@ -24,17 +24,19 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/client/pkg/utils/tsoutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/tests" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) type tsoProxyTestSuite struct { diff --git a/tests/integrations/mcs/tso/server_test.go b/tests/integrations/mcs/tso/server_test.go index b0660ed6577..09a199c2d52 100644 --- a/tests/integrations/mcs/tso/server_test.go +++ b/tests/integrations/mcs/tso/server_test.go @@ -24,10 +24,16 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/goleak" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/metapb" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/opt" "github.com/tikv/pd/client/pkg/caller" @@ -45,10 +51,6 @@ import ( "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" "github.com/tikv/pd/tests/integrations/mcs" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/goleak" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) func TestMain(m *testing.M) { diff --git a/tests/integrations/realcluster/cluster.go b/tests/integrations/realcluster/cluster.go index b90ec3cb4d9..cc4f6b54713 100644 --- a/tests/integrations/realcluster/cluster.go +++ b/tests/integrations/realcluster/cluster.go @@ -23,10 +23,11 @@ import ( "testing" "time" - "github.com/pingcap/log" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "go.uber.org/zap" + + "github.com/pingcap/log" ) type clusterSuite struct { diff --git a/tests/integrations/realcluster/cluster_id_test.go b/tests/integrations/realcluster/cluster_id_test.go index b6d4bc4e74d..82233cd5b8c 100644 --- a/tests/integrations/realcluster/cluster_id_test.go +++ b/tests/integrations/realcluster/cluster_id_test.go @@ -21,6 +21,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/opt" "github.com/tikv/pd/client/pkg/caller" diff --git a/tests/integrations/realcluster/etcd_key_test.go b/tests/integrations/realcluster/etcd_key_test.go index ee962cb0396..10c392834af 100644 --- a/tests/integrations/realcluster/etcd_key_test.go +++ b/tests/integrations/realcluster/etcd_key_test.go @@ -21,6 +21,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "github.com/tikv/pd/client/pkg/utils/testutil" ) diff --git a/tests/integrations/realcluster/mock_db.go b/tests/integrations/realcluster/mock_db.go index 2a636b9b86b..8a21bc1bb7d 100644 --- a/tests/integrations/realcluster/mock_db.go +++ b/tests/integrations/realcluster/mock_db.go @@ -20,11 +20,12 @@ import ( "github.com/DATA-DOG/go-sqlmock" mysqldriver "github.com/go-sql-driver/mysql" - "github.com/pingcap/log" "github.com/stretchr/testify/require" "gorm.io/driver/mysql" "gorm.io/gorm" "moul.io/zapgorm2" + + "github.com/pingcap/log" ) // TestDB is a test database diff --git a/tests/integrations/realcluster/reboot_pd_test.go b/tests/integrations/realcluster/reboot_pd_test.go index d35a921cb74..1a042872b93 100644 --- a/tests/integrations/realcluster/reboot_pd_test.go +++ b/tests/integrations/realcluster/reboot_pd_test.go @@ -20,6 +20,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "github.com/tikv/pd/client/http" ) diff --git a/tests/integrations/realcluster/scheduler_test.go b/tests/integrations/realcluster/scheduler_test.go index 8456e053bf8..0e4d10acd80 100644 --- a/tests/integrations/realcluster/scheduler_test.go +++ b/tests/integrations/realcluster/scheduler_test.go @@ -21,14 +21,16 @@ import ( "testing" "time" - "github.com/pingcap/log" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/zap" + + "github.com/pingcap/log" + "github.com/tikv/pd/client/http" "github.com/tikv/pd/client/pkg/utils/testutil" "github.com/tikv/pd/pkg/schedule/labeler" "github.com/tikv/pd/pkg/schedule/types" - "go.uber.org/zap" ) type schedulerSuite struct { diff --git a/tests/integrations/tso/client_test.go b/tests/integrations/tso/client_test.go index fa2cc80379d..2cda9f8734f 100644 --- a/tests/integrations/tso/client_test.go +++ b/tests/integrations/tso/client_test.go @@ -25,9 +25,11 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/clients/tso" "github.com/tikv/pd/client/opt" diff --git a/tests/integrations/tso/consistency_test.go b/tests/integrations/tso/consistency_test.go index 2ef2ebe3077..147f41a4591 100644 --- a/tests/integrations/tso/consistency_test.go +++ b/tests/integrations/tso/consistency_test.go @@ -20,10 +20,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + "google.golang.org/grpc" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/tsopb" - "github.com/stretchr/testify/suite" + tso "github.com/tikv/pd/pkg/mcs/tso/server" tsopkg "github.com/tikv/pd/pkg/tso" "github.com/tikv/pd/pkg/utils/keypath" @@ -31,7 +34,6 @@ import ( tu "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/utils/tsoutil" "github.com/tikv/pd/tests" - "google.golang.org/grpc" ) type tsoConsistencyTestSuite struct { diff --git a/tests/integrations/tso/server_test.go b/tests/integrations/tso/server_test.go index c0d71050964..f03db197b35 100644 --- a/tests/integrations/tso/server_test.go +++ b/tests/integrations/tso/server_test.go @@ -20,16 +20,18 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + "google.golang.org/grpc" + "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/tsopb" - "github.com/stretchr/testify/suite" + tso "github.com/tikv/pd/pkg/mcs/tso/server" tsopkg "github.com/tikv/pd/pkg/tso" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/tempurl" tu "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/tests" - "google.golang.org/grpc" ) type tsoServerTestSuite struct { diff --git a/tests/integrations/tso/testutil.go b/tests/integrations/tso/testutil.go index 5eda641486f..25f10e24d65 100644 --- a/tests/integrations/tso/testutil.go +++ b/tests/integrations/tso/testutil.go @@ -15,8 +15,9 @@ package tso import ( - "github.com/pingcap/kvproto/pkg/pdpb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/pdpb" ) const ( diff --git a/tests/registry/registry_test.go b/tests/registry/registry_test.go index 3551782d753..87d79c4f896 100644 --- a/tests/registry/registry_test.go +++ b/tests/registry/registry_test.go @@ -21,17 +21,19 @@ import ( "strings" "testing" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" + "go.uber.org/goleak" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/interop/grpc_testing" + + "github.com/pingcap/failpoint" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/mcs/registry" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/tests" - "go.uber.org/goleak" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/interop/grpc_testing" ) func TestMain(m *testing.M) { diff --git a/tests/scheduling_cluster.go b/tests/scheduling_cluster.go index 3f7c39eb81c..b5fc2429043 100644 --- a/tests/scheduling_cluster.go +++ b/tests/scheduling_cluster.go @@ -19,6 +19,7 @@ import ( "time" "github.com/stretchr/testify/require" + scheduling "github.com/tikv/pd/pkg/mcs/scheduling/server" sc "github.com/tikv/pd/pkg/mcs/scheduling/server/config" "github.com/tikv/pd/pkg/schedule/schedulers" diff --git a/tests/server/api/api_test.go b/tests/server/api/api_test.go index e1e4db3a26d..00c43d11309 100644 --- a/tests/server/api/api_test.go +++ b/tests/server/api/api_test.go @@ -27,11 +27,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "go.uber.org/goleak" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/testutil" @@ -40,7 +43,6 @@ import ( "github.com/tikv/pd/server/api" "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/server/api/checker_test.go b/tests/server/api/checker_test.go index 190e02ce607..14077ec30ae 100644 --- a/tests/server/api/checker_test.go +++ b/tests/server/api/checker_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + tu "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/tests" ) diff --git a/tests/server/api/operator_test.go b/tests/server/api/operator_test.go index 857ea6b3cdd..fd08a5ed556 100644 --- a/tests/server/api/operator_test.go +++ b/tests/server/api/operator_test.go @@ -24,8 +24,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/operator" "github.com/tikv/pd/pkg/schedule/placement" diff --git a/tests/server/api/region_test.go b/tests/server/api/region_test.go index 3a187629830..b98b4419a80 100644 --- a/tests/server/api/region_test.go +++ b/tests/server/api/region_test.go @@ -22,10 +22,12 @@ import ( "strconv" "testing" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/placement" tu "github.com/tikv/pd/pkg/utils/testutil" diff --git a/tests/server/api/rule_test.go b/tests/server/api/rule_test.go index 3e8adabd4ca..3982e61b6ea 100644 --- a/tests/server/api/rule_test.go +++ b/tests/server/api/rule_test.go @@ -25,9 +25,11 @@ import ( "sync" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/schedule/labeler" diff --git a/tests/server/api/scheduler_test.go b/tests/server/api/scheduler_test.go index 281f7c1dc7e..1f76c469cfd 100644 --- a/tests/server/api/scheduler_test.go +++ b/tests/server/api/scheduler_test.go @@ -24,10 +24,12 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/metapb" + sc "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/schedule/types" "github.com/tikv/pd/pkg/slice" diff --git a/tests/server/api/testutil.go b/tests/server/api/testutil.go index 163a25c9bbb..0546bf83ee5 100644 --- a/tests/server/api/testutil.go +++ b/tests/server/api/testutil.go @@ -23,6 +23,7 @@ import ( "path" "github.com/stretchr/testify/require" + "github.com/tikv/pd/tests" ) diff --git a/tests/server/apiv2/handlers/keyspace_test.go b/tests/server/apiv2/handlers/keyspace_test.go index f3fa01851ac..ea8f14cd971 100644 --- a/tests/server/apiv2/handlers/keyspace_test.go +++ b/tests/server/apiv2/handlers/keyspace_test.go @@ -19,15 +19,17 @@ import ( "fmt" "testing" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/goleak" + + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server/apiv2/handlers" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/server/apiv2/handlers/testutil.go b/tests/server/apiv2/handlers/testutil.go index 1a40e8d1ac7..e5280183c52 100644 --- a/tests/server/apiv2/handlers/testutil.go +++ b/tests/server/apiv2/handlers/testutil.go @@ -21,8 +21,10 @@ import ( "io" "net/http" - "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server/apiv2/handlers" diff --git a/tests/server/apiv2/handlers/tso_keyspace_group_test.go b/tests/server/apiv2/handlers/tso_keyspace_group_test.go index 91a07ccd6b1..796fd514eef 100644 --- a/tests/server/apiv2/handlers/tso_keyspace_group_test.go +++ b/tests/server/apiv2/handlers/tso_keyspace_group_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/server/apiv2/handlers" diff --git a/tests/server/cluster/cluster_test.go b/tests/server/cluster/cluster_test.go index dfdb9cb8685..b7467eb99a5 100644 --- a/tests/server/cluster/cluster_test.go +++ b/tests/server/cluster/cluster_test.go @@ -27,11 +27,15 @@ import ( "github.com/coreos/go-semver/semver" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/kvproto/pkg/replication_modepb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/dashboard" @@ -55,8 +59,6 @@ import ( "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" "github.com/tikv/pd/tests/server/api" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) const ( diff --git a/tests/server/cluster/cluster_work_test.go b/tests/server/cluster/cluster_work_test.go index 9c3bf799116..e0ba916bf7b 100644 --- a/tests/server/cluster/cluster_work_test.go +++ b/tests/server/cluster/cluster_work_test.go @@ -20,9 +20,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/errs" "github.com/tikv/pd/pkg/utils/testutil" diff --git a/tests/server/config/config_test.go b/tests/server/config/config_test.go index d225614fa96..bb387b68030 100644 --- a/tests/server/config/config_test.go +++ b/tests/server/config/config_test.go @@ -26,6 +26,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + cfg "github.com/tikv/pd/pkg/mcs/scheduling/server/config" "github.com/tikv/pd/pkg/ratelimit" sc "github.com/tikv/pd/pkg/schedule/config" diff --git a/tests/server/id/id_test.go b/tests/server/id/id_test.go index 465259063bf..e4633c480f2 100644 --- a/tests/server/id/id_test.go +++ b/tests/server/id/id_test.go @@ -19,13 +19,15 @@ import ( "sync" "testing" + "github.com/stretchr/testify/require" + "go.uber.org/goleak" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/server/join/join_fail/join_fail_test.go b/tests/server/join/join_fail/join_fail_test.go index 0e376281070..a037aa9e7b5 100644 --- a/tests/server/join/join_fail/join_fail_test.go +++ b/tests/server/join/join_fail/join_fail_test.go @@ -18,8 +18,10 @@ import ( "context" "testing" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/tests" ) diff --git a/tests/server/join/join_test.go b/tests/server/join/join_test.go index ea5eaaa35f4..8b0ce918377 100644 --- a/tests/server/join/join_test.go +++ b/tests/server/join/join_test.go @@ -22,6 +22,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/server" "github.com/tikv/pd/server/join" diff --git a/tests/server/keyspace/keyspace_test.go b/tests/server/keyspace/keyspace_test.go index a0175c1b727..5ce25794516 100644 --- a/tests/server/keyspace/keyspace_test.go +++ b/tests/server/keyspace/keyspace_test.go @@ -23,9 +23,11 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/pkg/codec" "github.com/tikv/pd/pkg/keyspace" "github.com/tikv/pd/pkg/schedule/labeler" diff --git a/tests/server/member/member_test.go b/tests/server/member/member_test.go index fd08e6557e8..cb8fd7bda00 100644 --- a/tests/server/member/member_test.go +++ b/tests/server/member/member_test.go @@ -25,17 +25,19 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/goleak" + "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/assertutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/server" "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/server/region_syncer/region_syncer_test.go b/tests/server/region_syncer/region_syncer_test.go index 80f5186f904..7edcaa5ad9b 100644 --- a/tests/server/region_syncer/region_syncer_test.go +++ b/tests/server/region_syncer/region_syncer_test.go @@ -19,14 +19,16 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/server/server_test.go b/tests/server/server_test.go index a5fcd33d2bc..77cd7aa5158 100644 --- a/tests/server/server_test.go +++ b/tests/server/server_test.go @@ -21,15 +21,17 @@ import ( "sync" "testing" + "github.com/stretchr/testify/require" + "go.uber.org/goleak" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/tempurl" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/server/storage/hot_region_storage_test.go b/tests/server/storage/hot_region_storage_test.go index 2eccb4b28e9..0643dda08d5 100644 --- a/tests/server/storage/hot_region_storage_test.go +++ b/tests/server/storage/hot_region_storage_test.go @@ -19,9 +19,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/statistics" "github.com/tikv/pd/pkg/statistics/utils" diff --git a/tests/server/tso/tso_test.go b/tests/server/tso/tso_test.go index cb6b87c83d3..51189966878 100644 --- a/tests/server/tso/tso_test.go +++ b/tests/server/tso/tso_test.go @@ -19,16 +19,18 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/goleak" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/tso" "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/server/watch/leader_watch_test.go b/tests/server/watch/leader_watch_test.go index 39c54b5c500..0a1a53c292d 100644 --- a/tests/server/watch/leader_watch_test.go +++ b/tests/server/watch/leader_watch_test.go @@ -19,12 +19,14 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" + "go.uber.org/goleak" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server/config" "github.com/tikv/pd/tests" - "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/tests/testutil.go b/tests/testutil.go index b56fd245bd3..4f2a6beb261 100644 --- a/tests/testutil.go +++ b/tests/testutil.go @@ -29,11 +29,14 @@ import ( "time" "github.com/docker/go-units" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/stretchr/testify/require" + bs "github.com/tikv/pd/pkg/basicserver" "github.com/tikv/pd/pkg/core" scheduling "github.com/tikv/pd/pkg/mcs/scheduling/server" @@ -46,7 +49,6 @@ import ( "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/versioninfo" "github.com/tikv/pd/server" - "go.uber.org/zap" ) var ( diff --git a/tests/tso_cluster.go b/tests/tso_cluster.go index 28a52580a1f..a6e664abb5b 100644 --- a/tests/tso_cluster.go +++ b/tests/tso_cluster.go @@ -20,8 +20,10 @@ import ( "sync" "time" - "github.com/pingcap/errors" "github.com/stretchr/testify/require" + + "github.com/pingcap/errors" + tso "github.com/tikv/pd/pkg/mcs/tso/server" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/storage/endpoint" diff --git a/tools/pd-analysis/analysis/transfer_counter.go b/tools/pd-analysis/analysis/transfer_counter.go index 98d131117b4..80401c44fcc 100644 --- a/tools/pd-analysis/analysis/transfer_counter.go +++ b/tools/pd-analysis/analysis/transfer_counter.go @@ -23,8 +23,9 @@ import ( "strings" "sync" - "github.com/tikv/pd/pkg/utils/syncutil" "go.uber.org/zap" + + "github.com/tikv/pd/pkg/utils/syncutil" ) // TransferCounter is to count transfer schedule for judging whether redundant diff --git a/tools/pd-analysis/main.go b/tools/pd-analysis/main.go index 510448ddddd..3188e7707f6 100644 --- a/tools/pd-analysis/main.go +++ b/tools/pd-analysis/main.go @@ -18,9 +18,11 @@ import ( "flag" "os" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/tools/pd-analysis/analysis" - "go.uber.org/zap" ) var ( diff --git a/tools/pd-api-bench/cases/cases.go b/tools/pd-api-bench/cases/cases.go index 118b8aaed5e..5d63b2356f6 100644 --- a/tools/pd-api-bench/cases/cases.go +++ b/tools/pd-api-bench/cases/cases.go @@ -21,12 +21,14 @@ import ( "strconv" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/log" + pd "github.com/tikv/pd/client" pdHttp "github.com/tikv/pd/client/http" "github.com/tikv/pd/client/opt" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) var ( diff --git a/tools/pd-api-bench/cases/controller.go b/tools/pd-api-bench/cases/controller.go index d6bc39d6d35..c0098bced45 100644 --- a/tools/pd-api-bench/cases/controller.go +++ b/tools/pd-api-bench/cases/controller.go @@ -19,12 +19,14 @@ import ( "sync" "time" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" + pd "github.com/tikv/pd/client" pdHttp "github.com/tikv/pd/client/http" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) var base = int64(time.Second) / int64(time.Microsecond) diff --git a/tools/pd-api-bench/config/config.go b/tools/pd-api-bench/config/config.go index 47a02461cfd..c1c17624e2f 100644 --- a/tools/pd-api-bench/config/config.go +++ b/tools/pd-api-bench/config/config.go @@ -15,12 +15,14 @@ package config import ( + flag "github.com/spf13/pflag" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" - flag "github.com/spf13/pflag" + "github.com/tikv/pd/pkg/utils/configutil" "github.com/tikv/pd/tools/pd-api-bench/cases" - "go.uber.org/zap" ) // Config is the heartbeat-bench configuration. diff --git a/tools/pd-api-bench/main.go b/tools/pd-api-bench/main.go index 2b96b0a4115..0d9235d5055 100644 --- a/tools/pd-api-bench/main.go +++ b/tools/pd-api-bench/main.go @@ -29,10 +29,16 @@ import ( "github.com/gin-contrib/gzip" "github.com/gin-contrib/pprof" "github.com/gin-gonic/gin" - "github.com/pingcap/errors" - "github.com/pingcap/log" "github.com/prometheus/client_golang/prometheus" flag "github.com/spf13/pflag" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/keepalive" + + "github.com/pingcap/errors" + "github.com/pingcap/log" + pd "github.com/tikv/pd/client" pdHttp "github.com/tikv/pd/client/http" "github.com/tikv/pd/client/opt" @@ -42,10 +48,6 @@ import ( "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/tools/pd-api-bench/cases" "github.com/tikv/pd/tools/pd-api-bench/config" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/keepalive" ) var ( diff --git a/tools/pd-backup/main.go b/tools/pd-backup/main.go index c0ee07afd6e..e5aaad62788 100644 --- a/tools/pd-backup/main.go +++ b/tools/pd-backup/main.go @@ -21,9 +21,10 @@ import ( "strings" "time" - "github.com/tikv/pd/tools/pd-backup/pdbackup" "go.etcd.io/etcd/client/pkg/v3/transport" clientv3 "go.etcd.io/etcd/client/v3" + + "github.com/tikv/pd/tools/pd-backup/pdbackup" ) var ( diff --git a/tools/pd-backup/pdbackup/backup.go b/tools/pd-backup/pdbackup/backup.go index d02e651b879..e3fd3e682cb 100644 --- a/tools/pd-backup/pdbackup/backup.go +++ b/tools/pd-backup/pdbackup/backup.go @@ -25,11 +25,12 @@ import ( "path" "strconv" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/server/config" - clientv3 "go.etcd.io/etcd/client/v3" ) const ( diff --git a/tools/pd-backup/pdbackup/backup_test.go b/tools/pd-backup/pdbackup/backup_test.go index d23f1878b85..3734fb6782b 100644 --- a/tools/pd-backup/pdbackup/backup_test.go +++ b/tools/pd-backup/pdbackup/backup_test.go @@ -16,15 +16,16 @@ import ( "time" "github.com/stretchr/testify/suite" + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/server/v3/embed" + "go.uber.org/goleak" + sc "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/keypath" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/server/config" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/server/v3/embed" - "go.uber.org/goleak" ) var ( diff --git a/tools/pd-backup/tests/backup_test.go b/tools/pd-backup/tests/backup_test.go index 05d2b7b92ed..7c8c03d96e0 100644 --- a/tools/pd-backup/tests/backup_test.go +++ b/tools/pd-backup/tests/backup_test.go @@ -23,9 +23,10 @@ import ( "time" "github.com/stretchr/testify/require" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/tikv/pd/tests" "github.com/tikv/pd/tools/pd-backup/pdbackup" - clientv3 "go.etcd.io/etcd/client/v3" ) func TestBackup(t *testing.T) { diff --git a/tools/pd-ctl/main.go b/tools/pd-ctl/main.go index 0d052d95680..348310f9e7a 100644 --- a/tools/pd-ctl/main.go +++ b/tools/pd-ctl/main.go @@ -20,10 +20,12 @@ import ( "os/signal" "syscall" + "go.uber.org/zap/zapcore" + "github.com/pingcap/log" + "github.com/tikv/pd/tools/pd-ctl/pdctl" "github.com/tikv/pd/tools/pd-ctl/pdctl/command" - "go.uber.org/zap/zapcore" ) func main() { diff --git a/tools/pd-ctl/pdctl/command/config_command.go b/tools/pd-ctl/pdctl/command/config_command.go index 126d758fe05..2e9903db550 100644 --- a/tools/pd-ctl/pdctl/command/config_command.go +++ b/tools/pd-ctl/pdctl/command/config_command.go @@ -27,6 +27,7 @@ import ( "strings" "github.com/spf13/cobra" + "github.com/tikv/pd/pkg/schedule/placement" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/reflectutil" diff --git a/tools/pd-ctl/pdctl/command/global.go b/tools/pd-ctl/pdctl/command/global.go index c7e0cfd691d..ce79277db1b 100644 --- a/tools/pd-ctl/pdctl/command/global.go +++ b/tools/pd-ctl/pdctl/command/global.go @@ -24,12 +24,14 @@ import ( "os" "strings" + "github.com/spf13/cobra" + "go.etcd.io/etcd/client/pkg/v3/transport" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" - "github.com/spf13/cobra" + pd "github.com/tikv/pd/client/http" "github.com/tikv/pd/pkg/utils/apiutil" - "go.etcd.io/etcd/client/pkg/v3/transport" ) const ( diff --git a/tools/pd-ctl/pdctl/command/hot_command.go b/tools/pd-ctl/pdctl/command/hot_command.go index 77c0ee4d7de..4a24e0d6ce4 100644 --- a/tools/pd-ctl/pdctl/command/hot_command.go +++ b/tools/pd-ctl/pdctl/command/hot_command.go @@ -22,8 +22,10 @@ import ( "strconv" "strings" - "github.com/pingcap/errors" "github.com/spf13/cobra" + + "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/storage" ) diff --git a/tools/pd-ctl/pdctl/command/keyspace_command.go b/tools/pd-ctl/pdctl/command/keyspace_command.go index 93a99abc39f..2ecee481df4 100644 --- a/tools/pd-ctl/pdctl/command/keyspace_command.go +++ b/tools/pd-ctl/pdctl/command/keyspace_command.go @@ -22,6 +22,7 @@ import ( "strings" "github.com/spf13/cobra" + "github.com/tikv/pd/server/apiv2/handlers" ) diff --git a/tools/pd-ctl/pdctl/command/keyspace_group_command.go b/tools/pd-ctl/pdctl/command/keyspace_group_command.go index f315417e555..ec8ec120459 100644 --- a/tools/pd-ctl/pdctl/command/keyspace_group_command.go +++ b/tools/pd-ctl/pdctl/command/keyspace_group_command.go @@ -23,6 +23,7 @@ import ( "strings" "github.com/spf13/cobra" + "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/storage/endpoint" ) diff --git a/tools/pd-ctl/pdctl/command/label_command.go b/tools/pd-ctl/pdctl/command/label_command.go index 6d95465392f..d6360709cea 100644 --- a/tools/pd-ctl/pdctl/command/label_command.go +++ b/tools/pd-ctl/pdctl/command/label_command.go @@ -20,6 +20,7 @@ import ( "net/http" "github.com/spf13/cobra" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/response" sc "github.com/tikv/pd/pkg/schedule/config" diff --git a/tools/pd-ctl/pdctl/command/log_command.go b/tools/pd-ctl/pdctl/command/log_command.go index 56c4438a6c3..086299433dd 100644 --- a/tools/pd-ctl/pdctl/command/log_command.go +++ b/tools/pd-ctl/pdctl/command/log_command.go @@ -20,6 +20,7 @@ import ( "net/http" "github.com/spf13/cobra" + "github.com/tikv/pd/pkg/utils/apiutil" ) diff --git a/tools/pd-ctl/pdctl/command/operator.go b/tools/pd-ctl/pdctl/command/operator.go index 4e7771580de..8e3fcc3ead6 100644 --- a/tools/pd-ctl/pdctl/command/operator.go +++ b/tools/pd-ctl/pdctl/command/operator.go @@ -19,8 +19,9 @@ import ( "net/http" "strconv" - "github.com/pingcap/errors" "github.com/spf13/cobra" + + "github.com/pingcap/errors" ) var ( diff --git a/tools/pd-ctl/pdctl/command/plugin_command.go b/tools/pd-ctl/pdctl/command/plugin_command.go index 9716d1d7755..de530904477 100644 --- a/tools/pd-ctl/pdctl/command/plugin_command.go +++ b/tools/pd-ctl/pdctl/command/plugin_command.go @@ -20,6 +20,7 @@ import ( "net/http" "github.com/spf13/cobra" + "github.com/tikv/pd/pkg/schedule" ) diff --git a/tools/pd-ctl/pdctl/command/region_command.go b/tools/pd-ctl/pdctl/command/region_command.go index 3536b01a606..743d1e1f4c7 100644 --- a/tools/pd-ctl/pdctl/command/region_command.go +++ b/tools/pd-ctl/pdctl/command/region_command.go @@ -26,9 +26,10 @@ import ( "strconv" "strings" - "github.com/pingcap/errors" "github.com/spf13/cobra" "github.com/spf13/pflag" + + "github.com/pingcap/errors" ) var ( diff --git a/tools/pd-ctl/pdctl/command/scheduler.go b/tools/pd-ctl/pdctl/command/scheduler.go index b8e05604b16..5dc05aff62f 100644 --- a/tools/pd-ctl/pdctl/command/scheduler.go +++ b/tools/pd-ctl/pdctl/command/scheduler.go @@ -24,8 +24,9 @@ import ( "strconv" "strings" - "github.com/pingcap/errors" "github.com/spf13/cobra" + + "github.com/pingcap/errors" ) var ( diff --git a/tools/pd-ctl/pdctl/command/store_command.go b/tools/pd-ctl/pdctl/command/store_command.go index 0ad56e0ac72..fc398902508 100644 --- a/tools/pd-ctl/pdctl/command/store_command.go +++ b/tools/pd-ctl/pdctl/command/store_command.go @@ -23,11 +23,13 @@ import ( "strconv" "strings" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/spf13/cobra" - "github.com/tikv/pd/pkg/response" "golang.org/x/text/cases" "golang.org/x/text/language" + + "github.com/pingcap/kvproto/pkg/metapb" + + "github.com/tikv/pd/pkg/response" ) var ( diff --git a/tools/pd-ctl/pdctl/command/tso_command.go b/tools/pd-ctl/pdctl/command/tso_command.go index 689420854ee..7a4e8ec6d6e 100644 --- a/tools/pd-ctl/pdctl/command/tso_command.go +++ b/tools/pd-ctl/pdctl/command/tso_command.go @@ -18,6 +18,7 @@ import ( "strconv" "github.com/spf13/cobra" + "github.com/tikv/pd/pkg/utils/tsoutil" ) diff --git a/tools/pd-ctl/pdctl/ctl.go b/tools/pd-ctl/pdctl/ctl.go index 77f1601c8f5..e975bbf7a31 100644 --- a/tools/pd-ctl/pdctl/ctl.go +++ b/tools/pd-ctl/pdctl/ctl.go @@ -24,6 +24,7 @@ import ( shellwords "github.com/mattn/go-shellwords" "github.com/spf13/cobra" "github.com/spf13/pflag" + "github.com/tikv/pd/pkg/versioninfo" "github.com/tikv/pd/tools/pd-ctl/pdctl/command" ) diff --git a/tools/pd-ctl/tests/cluster/cluster_test.go b/tools/pd-ctl/tests/cluster/cluster_test.go index 46681da9319..8f087bdb094 100644 --- a/tools/pd-ctl/tests/cluster/cluster_test.go +++ b/tools/pd-ctl/tests/cluster/cluster_test.go @@ -21,8 +21,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + clusterpkg "github.com/tikv/pd/server/cluster" pdTests "github.com/tikv/pd/tests" ctl "github.com/tikv/pd/tools/pd-ctl/pdctl" diff --git a/tools/pd-ctl/tests/completion/completion_test.go b/tools/pd-ctl/tests/completion/completion_test.go index cf4717a26aa..da043d2727d 100644 --- a/tools/pd-ctl/tests/completion/completion_test.go +++ b/tools/pd-ctl/tests/completion/completion_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/require" + ctl "github.com/tikv/pd/tools/pd-ctl/pdctl" "github.com/tikv/pd/tools/pd-ctl/tests" ) diff --git a/tools/pd-ctl/tests/config/config_test.go b/tools/pd-ctl/tests/config/config_test.go index 6dc7e9fb269..cf9e4163457 100644 --- a/tools/pd-ctl/tests/config/config_test.go +++ b/tools/pd-ctl/tests/config/config_test.go @@ -26,10 +26,12 @@ import ( "time" "github.com/coreos/go-semver/semver" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/ratelimit" sc "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/schedule/placement" diff --git a/tools/pd-ctl/tests/global_test.go b/tools/pd-ctl/tests/global_test.go index 766e357088e..00987f2a8a1 100644 --- a/tools/pd-ctl/tests/global_test.go +++ b/tools/pd-ctl/tests/global_test.go @@ -21,8 +21,10 @@ import ( "net/http" "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/assertutil" "github.com/tikv/pd/pkg/utils/testutil" diff --git a/tools/pd-ctl/tests/health/health_test.go b/tools/pd-ctl/tests/health/health_test.go index be9d5027988..c3b9e9979a4 100644 --- a/tools/pd-ctl/tests/health/health_test.go +++ b/tools/pd-ctl/tests/health/health_test.go @@ -24,6 +24,8 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.etcd.io/etcd/client/pkg/v3/transport" + "github.com/tikv/pd/pkg/utils/grpcutil" "github.com/tikv/pd/server/api" "github.com/tikv/pd/server/cluster" @@ -31,7 +33,6 @@ import ( pdTests "github.com/tikv/pd/tests" ctl "github.com/tikv/pd/tools/pd-ctl/pdctl" "github.com/tikv/pd/tools/pd-ctl/tests" - "go.etcd.io/etcd/client/pkg/v3/transport" ) func TestHealth(t *testing.T) { diff --git a/tools/pd-ctl/tests/helper.go b/tools/pd-ctl/tests/helper.go index bdacae48c22..8e5963440ee 100644 --- a/tools/pd-ctl/tests/helper.go +++ b/tools/pd-ctl/tests/helper.go @@ -20,6 +20,7 @@ import ( "github.com/spf13/cobra" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/response" "github.com/tikv/pd/pkg/utils/typeutil" diff --git a/tools/pd-ctl/tests/hot/hot_test.go b/tools/pd-ctl/tests/hot/hot_test.go index e12b6a39a60..d01f861d861 100644 --- a/tools/pd-ctl/tests/hot/hot_test.go +++ b/tools/pd-ctl/tests/hot/hot_test.go @@ -22,10 +22,12 @@ import ( "time" "github.com/docker/go-units" - "github.com/pingcap/kvproto/pkg/metapb" - "github.com/pingcap/kvproto/pkg/pdpb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/handler" "github.com/tikv/pd/pkg/statistics" diff --git a/tools/pd-ctl/tests/keyspace/keyspace_group_test.go b/tools/pd-ctl/tests/keyspace/keyspace_group_test.go index 9c16b0751f6..fca00f2fd3c 100644 --- a/tools/pd-ctl/tests/keyspace/keyspace_group_test.go +++ b/tools/pd-ctl/tests/keyspace/keyspace_group_test.go @@ -22,8 +22,10 @@ import ( "strings" "testing" - "github.com/pingcap/failpoint" "github.com/stretchr/testify/require" + + "github.com/pingcap/failpoint" + "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/testutil" diff --git a/tools/pd-ctl/tests/keyspace/keyspace_test.go b/tools/pd-ctl/tests/keyspace/keyspace_test.go index 4aa3be1d21c..23a1148cd66 100644 --- a/tools/pd-ctl/tests/keyspace/keyspace_test.go +++ b/tools/pd-ctl/tests/keyspace/keyspace_test.go @@ -22,10 +22,12 @@ import ( "strings" "testing" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/keyspacepb" + "github.com/tikv/pd/pkg/keyspace" "github.com/tikv/pd/pkg/mcs/utils/constant" "github.com/tikv/pd/pkg/utils/testutil" diff --git a/tools/pd-ctl/tests/label/label_test.go b/tools/pd-ctl/tests/label/label_test.go index 057c9d9d9bb..b4fcbfc0e2d 100644 --- a/tools/pd-ctl/tests/label/label_test.go +++ b/tools/pd-ctl/tests/label/label_test.go @@ -21,8 +21,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/response" "github.com/tikv/pd/server/config" pdTests "github.com/tikv/pd/tests" diff --git a/tools/pd-ctl/tests/log/log_test.go b/tools/pd-ctl/tests/log/log_test.go index 274bc4ce7df..300b016f37b 100644 --- a/tools/pd-ctl/tests/log/log_test.go +++ b/tools/pd-ctl/tests/log/log_test.go @@ -19,8 +19,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + pdTests "github.com/tikv/pd/tests" ctl "github.com/tikv/pd/tools/pd-ctl/pdctl" "github.com/tikv/pd/tools/pd-ctl/tests" diff --git a/tools/pd-ctl/tests/member/member_test.go b/tools/pd-ctl/tests/member/member_test.go index dd3e465ae38..0f7d574945f 100644 --- a/tools/pd-ctl/tests/member/member_test.go +++ b/tools/pd-ctl/tests/member/member_test.go @@ -20,8 +20,10 @@ import ( "fmt" "testing" - "github.com/pingcap/kvproto/pkg/pdpb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/testutil" pdTests "github.com/tikv/pd/tests" diff --git a/tools/pd-ctl/tests/operator/operator_test.go b/tools/pd-ctl/tests/operator/operator_test.go index 91e97c66dbd..9e8c374ea49 100644 --- a/tools/pd-ctl/tests/operator/operator_test.go +++ b/tools/pd-ctl/tests/operator/operator_test.go @@ -22,8 +22,10 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/suite" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/server/config" diff --git a/tools/pd-ctl/tests/region/region_test.go b/tools/pd-ctl/tests/region/region_test.go index 03a1c04ef19..06077a6184a 100644 --- a/tools/pd-ctl/tests/region/region_test.go +++ b/tools/pd-ctl/tests/region/region_test.go @@ -20,9 +20,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/response" "github.com/tikv/pd/server/api" diff --git a/tools/pd-ctl/tests/resourcemanager/resource_manager_command_test.go b/tools/pd-ctl/tests/resourcemanager/resource_manager_command_test.go index 3da72244215..ceab3b07ab7 100644 --- a/tools/pd-ctl/tests/resourcemanager/resource_manager_command_test.go +++ b/tools/pd-ctl/tests/resourcemanager/resource_manager_command_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/stretchr/testify/suite" + "github.com/tikv/pd/pkg/mcs/resourcemanager/server" "github.com/tikv/pd/pkg/utils/typeutil" pdTests "github.com/tikv/pd/tests" diff --git a/tools/pd-ctl/tests/safepoint/safepoint_test.go b/tools/pd-ctl/tests/safepoint/safepoint_test.go index 9a9c54460bd..5a7ba8a2bc8 100644 --- a/tools/pd-ctl/tests/safepoint/safepoint_test.go +++ b/tools/pd-ctl/tests/safepoint/safepoint_test.go @@ -22,6 +22,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/server/api" pdTests "github.com/tikv/pd/tests" diff --git a/tools/pd-ctl/tests/scheduler/scheduler_test.go b/tools/pd-ctl/tests/scheduler/scheduler_test.go index 3450e59d178..787bdaa4521 100644 --- a/tools/pd-ctl/tests/scheduler/scheduler_test.go +++ b/tools/pd-ctl/tests/scheduler/scheduler_test.go @@ -22,11 +22,13 @@ import ( "testing" "time" - "github.com/pingcap/failpoint" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/spf13/cobra" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + + "github.com/pingcap/failpoint" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/slice" diff --git a/tools/pd-ctl/tests/store/store_test.go b/tools/pd-ctl/tests/store/store_test.go index 6f704a25e8c..79a83325f8b 100644 --- a/tools/pd-ctl/tests/store/store_test.go +++ b/tools/pd-ctl/tests/store/store_test.go @@ -24,8 +24,11 @@ import ( "testing" "time" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + "go.etcd.io/etcd/client/pkg/v3/transport" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/core/storelimit" "github.com/tikv/pd/pkg/response" @@ -35,7 +38,6 @@ import ( pdTests "github.com/tikv/pd/tests" ctl "github.com/tikv/pd/tools/pd-ctl/pdctl" "github.com/tikv/pd/tools/pd-ctl/tests" - "go.etcd.io/etcd/client/pkg/v3/transport" ) func TestStoreLimitV2(t *testing.T) { diff --git a/tools/pd-ctl/tests/tso/tso_test.go b/tools/pd-ctl/tests/tso/tso_test.go index 63816c40e7a..30fdda96438 100644 --- a/tools/pd-ctl/tests/tso/tso_test.go +++ b/tools/pd-ctl/tests/tso/tso_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/stretchr/testify/require" + ctl "github.com/tikv/pd/tools/pd-ctl/pdctl" "github.com/tikv/pd/tools/pd-ctl/tests" ) diff --git a/tools/pd-ctl/tests/unsafe/unsafe_operation_test.go b/tools/pd-ctl/tests/unsafe/unsafe_operation_test.go index da89749c2f2..652645e1570 100644 --- a/tools/pd-ctl/tests/unsafe/unsafe_operation_test.go +++ b/tools/pd-ctl/tests/unsafe/unsafe_operation_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/stretchr/testify/require" + pdTests "github.com/tikv/pd/tests" ctl "github.com/tikv/pd/tools/pd-ctl/pdctl" "github.com/tikv/pd/tools/pd-ctl/tests" diff --git a/tools/pd-heartbeat-bench/config/config.go b/tools/pd-heartbeat-bench/config/config.go index dc5a2a6a047..41c14845074 100644 --- a/tools/pd-heartbeat-bench/config/config.go +++ b/tools/pd-heartbeat-bench/config/config.go @@ -4,11 +4,13 @@ import ( "sync/atomic" "github.com/BurntSushi/toml" + flag "github.com/spf13/pflag" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/log" - flag "github.com/spf13/pflag" + "github.com/tikv/pd/pkg/utils/configutil" - "go.uber.org/zap" ) const ( diff --git a/tools/pd-heartbeat-bench/main.go b/tools/pd-heartbeat-bench/main.go index 7150c81537a..60b1db6734d 100644 --- a/tools/pd-heartbeat-bench/main.go +++ b/tools/pd-heartbeat-bench/main.go @@ -34,11 +34,15 @@ import ( "github.com/gin-contrib/gzip" "github.com/gin-contrib/pprof" "github.com/gin-gonic/gin" + "github.com/spf13/pflag" + "go.etcd.io/etcd/pkg/v3/report" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" "github.com/pingcap/log" - "github.com/spf13/pflag" + pdHttp "github.com/tikv/pd/client/http" "github.com/tikv/pd/client/pkg/utils/grpcutil" "github.com/tikv/pd/client/pkg/utils/tlsutil" @@ -48,8 +52,6 @@ import ( "github.com/tikv/pd/pkg/utils/logutil" "github.com/tikv/pd/tools/pd-heartbeat-bench/config" "github.com/tikv/pd/tools/pd-heartbeat-bench/metrics" - "go.etcd.io/etcd/pkg/v3/report" - "go.uber.org/zap" ) const ( diff --git a/tools/pd-heartbeat-bench/metrics/util.go b/tools/pd-heartbeat-bench/metrics/util.go index 9a61feee420..5e709630e27 100644 --- a/tools/pd-heartbeat-bench/metrics/util.go +++ b/tools/pd-heartbeat-bench/metrics/util.go @@ -22,12 +22,13 @@ import ( "strings" "time" - "github.com/pingcap/log" "github.com/prometheus/client_golang/api" v1 "github.com/prometheus/client_golang/api/prometheus/v1" "github.com/prometheus/common/model" "go.etcd.io/etcd/pkg/v3/report" "go.uber.org/zap" + + "github.com/pingcap/log" ) var ( diff --git a/tools/pd-recover/main.go b/tools/pd-recover/main.go index 3423d06bb9f..bd5ebf76d74 100644 --- a/tools/pd-recover/main.go +++ b/tools/pd-recover/main.go @@ -24,12 +24,14 @@ import ( "strings" "time" + "go.etcd.io/etcd/client/pkg/v3/transport" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/utils/etcdutil" "github.com/tikv/pd/pkg/utils/typeutil" "github.com/tikv/pd/pkg/versioninfo" - "go.etcd.io/etcd/client/pkg/v3/transport" - clientv3 "go.etcd.io/etcd/client/v3" ) var ( diff --git a/tools/pd-simulator/main.go b/tools/pd-simulator/main.go index 609ed3b06e0..59a58f0a00b 100644 --- a/tools/pd-simulator/main.go +++ b/tools/pd-simulator/main.go @@ -23,8 +23,11 @@ import ( "time" "github.com/BurntSushi/toml" - "github.com/pingcap/log" flag "github.com/spf13/pflag" + "go.uber.org/zap" + + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/schedule/schedulers" "github.com/tikv/pd/pkg/statistics" "github.com/tikv/pd/pkg/utils/logutil" @@ -37,7 +40,6 @@ import ( "github.com/tikv/pd/tools/pd-simulator/simulator/cases" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/simutil" - "go.uber.org/zap" ) var ( diff --git a/tools/pd-simulator/simulator/cases/balance_leader.go b/tools/pd-simulator/simulator/cases/balance_leader.go index a6790548dc1..f0ed73a4a9c 100644 --- a/tools/pd-simulator/simulator/cases/balance_leader.go +++ b/tools/pd-simulator/simulator/cases/balance_leader.go @@ -16,7 +16,9 @@ package cases import ( "github.com/docker/go-units" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" diff --git a/tools/pd-simulator/simulator/cases/balance_region.go b/tools/pd-simulator/simulator/cases/balance_region.go index d4ef7ad986f..8c7bbbe19d8 100644 --- a/tools/pd-simulator/simulator/cases/balance_region.go +++ b/tools/pd-simulator/simulator/cases/balance_region.go @@ -18,6 +18,7 @@ import ( "time" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" diff --git a/tools/pd-simulator/simulator/cases/cases.go b/tools/pd-simulator/simulator/cases/cases.go index 026e095342b..c1de896074f 100644 --- a/tools/pd-simulator/simulator/cases/cases.go +++ b/tools/pd-simulator/simulator/cases/cases.go @@ -16,6 +16,7 @@ package cases import ( "github.com/pingcap/kvproto/pkg/metapb" + pdHttp "github.com/tikv/pd/client/http" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/typeutil" diff --git a/tools/pd-simulator/simulator/cases/diagnose_label_isolation.go b/tools/pd-simulator/simulator/cases/diagnose_label_isolation.go index 8e65feefea4..06e0582f5f8 100644 --- a/tools/pd-simulator/simulator/cases/diagnose_label_isolation.go +++ b/tools/pd-simulator/simulator/cases/diagnose_label_isolation.go @@ -19,12 +19,14 @@ import ( "time" "github.com/docker/go-units" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" "github.com/tikv/pd/tools/pd-simulator/simulator/simutil" - "go.uber.org/zap" ) func newLabelNotMatch1(_ *sc.SimConfig) *Case { diff --git a/tools/pd-simulator/simulator/cases/diagnose_rule.go b/tools/pd-simulator/simulator/cases/diagnose_rule.go index 4e7031a3a01..d1a8350dbbc 100644 --- a/tools/pd-simulator/simulator/cases/diagnose_rule.go +++ b/tools/pd-simulator/simulator/cases/diagnose_rule.go @@ -18,14 +18,16 @@ import ( "time" "github.com/docker/go-units" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" + pdHttp "github.com/tikv/pd/client/http" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/schedule/placement" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" "github.com/tikv/pd/tools/pd-simulator/simulator/simutil" - "go.uber.org/zap" ) func newRule1(_ *sc.SimConfig) *Case { diff --git a/tools/pd-simulator/simulator/cases/hot_read.go b/tools/pd-simulator/simulator/cases/hot_read.go index 22ff70d9312..87637063385 100644 --- a/tools/pd-simulator/simulator/cases/hot_read.go +++ b/tools/pd-simulator/simulator/cases/hot_read.go @@ -18,7 +18,9 @@ import ( "fmt" "github.com/docker/go-units" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" diff --git a/tools/pd-simulator/simulator/cases/hot_write.go b/tools/pd-simulator/simulator/cases/hot_write.go index adb6eb0756a..43494324936 100644 --- a/tools/pd-simulator/simulator/cases/hot_write.go +++ b/tools/pd-simulator/simulator/cases/hot_write.go @@ -18,7 +18,9 @@ import ( "fmt" "github.com/docker/go-units" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" diff --git a/tools/pd-simulator/simulator/cases/import_data.go b/tools/pd-simulator/simulator/cases/import_data.go index 3d329081f9e..c06e9e7dd44 100644 --- a/tools/pd-simulator/simulator/cases/import_data.go +++ b/tools/pd-simulator/simulator/cases/import_data.go @@ -21,14 +21,16 @@ import ( "github.com/docker/go-units" "github.com/go-echarts/go-echarts/charts" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/codec" "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" "github.com/tikv/pd/tools/pd-simulator/simulator/simutil" - "go.uber.org/zap" ) func newImportData(config *sc.SimConfig) *Case { diff --git a/tools/pd-simulator/simulator/cases/makeup_down_replica.go b/tools/pd-simulator/simulator/cases/makeup_down_replica.go index ec664e91254..d5a5021b8cf 100644 --- a/tools/pd-simulator/simulator/cases/makeup_down_replica.go +++ b/tools/pd-simulator/simulator/cases/makeup_down_replica.go @@ -16,7 +16,9 @@ package cases import ( "github.com/docker/go-units" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" diff --git a/tools/pd-simulator/simulator/cases/region_merge.go b/tools/pd-simulator/simulator/cases/region_merge.go index 9a278c851bd..8f19f375c8e 100644 --- a/tools/pd-simulator/simulator/cases/region_merge.go +++ b/tools/pd-simulator/simulator/cases/region_merge.go @@ -16,7 +16,9 @@ package cases import ( "github.com/docker/go-units" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" diff --git a/tools/pd-simulator/simulator/cases/region_split.go b/tools/pd-simulator/simulator/cases/region_split.go index 8c1f3ac7759..8299cbdf136 100644 --- a/tools/pd-simulator/simulator/cases/region_split.go +++ b/tools/pd-simulator/simulator/cases/region_split.go @@ -16,7 +16,9 @@ package cases import ( "github.com/docker/go-units" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" diff --git a/tools/pd-simulator/simulator/cases/scale_tikv.go b/tools/pd-simulator/simulator/cases/scale_tikv.go index 9cfe8d9dcad..49dc70e64fb 100644 --- a/tools/pd-simulator/simulator/cases/scale_tikv.go +++ b/tools/pd-simulator/simulator/cases/scale_tikv.go @@ -16,6 +16,7 @@ package cases import ( "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" diff --git a/tools/pd-simulator/simulator/cases/stable_env.go b/tools/pd-simulator/simulator/cases/stable_env.go index 54a9f84341f..0a0c72698d8 100644 --- a/tools/pd-simulator/simulator/cases/stable_env.go +++ b/tools/pd-simulator/simulator/cases/stable_env.go @@ -16,7 +16,9 @@ package cases import ( "github.com/docker/go-units" + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" diff --git a/tools/pd-simulator/simulator/client.go b/tools/pd-simulator/simulator/client.go index 4de2ea52f88..4c84d308af7 100644 --- a/tools/pd-simulator/simulator/client.go +++ b/tools/pd-simulator/simulator/client.go @@ -23,18 +23,20 @@ import ( "sync/atomic" "time" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" + pdHttp "github.com/tikv/pd/client/http" sd "github.com/tikv/pd/client/servicediscovery" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/typeutil" sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/simutil" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) // Client is a PD (Placement Driver) client. diff --git a/tools/pd-simulator/simulator/config/config.go b/tools/pd-simulator/simulator/config/config.go index ece3b6fd91f..ead9e50e6af 100644 --- a/tools/pd-simulator/simulator/config/config.go +++ b/tools/pd-simulator/simulator/config/config.go @@ -21,6 +21,7 @@ import ( "github.com/BurntSushi/toml" "github.com/docker/go-units" + pdHttp "github.com/tikv/pd/client/http" sc "github.com/tikv/pd/pkg/schedule/config" "github.com/tikv/pd/pkg/utils/configutil" diff --git a/tools/pd-simulator/simulator/conn.go b/tools/pd-simulator/simulator/conn.go index b1000c0f17b..332f46eb573 100644 --- a/tools/pd-simulator/simulator/conn.go +++ b/tools/pd-simulator/simulator/conn.go @@ -16,6 +16,7 @@ package simulator import ( "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/tools/pd-simulator/simulator/cases" "github.com/tikv/pd/tools/pd-simulator/simulator/config" ) diff --git a/tools/pd-simulator/simulator/drive.go b/tools/pd-simulator/simulator/drive.go index c8c325cfca6..0d81a2af1ab 100644 --- a/tools/pd-simulator/simulator/drive.go +++ b/tools/pd-simulator/simulator/drive.go @@ -26,10 +26,14 @@ import ( "sync/atomic" "time" + "github.com/prometheus/client_golang/prometheus/promhttp" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" - "github.com/prometheus/client_golang/prometheus/promhttp" + pdHttp "github.com/tikv/pd/client/http" sd "github.com/tikv/pd/client/servicediscovery" "github.com/tikv/pd/pkg/core" @@ -38,8 +42,6 @@ import ( "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" "github.com/tikv/pd/tools/pd-simulator/simulator/simutil" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) // Driver promotes the cluster status change. diff --git a/tools/pd-simulator/simulator/event.go b/tools/pd-simulator/simulator/event.go index d22f35756ef..719e12f5fea 100644 --- a/tools/pd-simulator/simulator/event.go +++ b/tools/pd-simulator/simulator/event.go @@ -22,12 +22,14 @@ import ( "strconv" "sync" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/tools/pd-simulator/simulator/cases" "github.com/tikv/pd/tools/pd-simulator/simulator/simutil" - "go.uber.org/zap" ) // Event affects the status of the cluster. diff --git a/tools/pd-simulator/simulator/node.go b/tools/pd-simulator/simulator/node.go index 59b0d393c47..edacf5c4129 100644 --- a/tools/pd-simulator/simulator/node.go +++ b/tools/pd-simulator/simulator/node.go @@ -22,8 +22,11 @@ import ( "time" "github.com/docker/go-units" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/ratelimit" "github.com/tikv/pd/pkg/utils/syncutil" @@ -32,7 +35,6 @@ import ( sc "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/info" "github.com/tikv/pd/tools/pd-simulator/simulator/simutil" - "go.uber.org/zap" ) const ( diff --git a/tools/pd-simulator/simulator/raft.go b/tools/pd-simulator/simulator/raft.go index 7f3bf78622f..13371cefdb8 100644 --- a/tools/pd-simulator/simulator/raft.go +++ b/tools/pd-simulator/simulator/raft.go @@ -17,14 +17,16 @@ package simulator import ( "context" + "go.uber.org/zap" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/syncutil" "github.com/tikv/pd/tools/pd-simulator/simulator/cases" "github.com/tikv/pd/tools/pd-simulator/simulator/config" "github.com/tikv/pd/tools/pd-simulator/simulator/simutil" - "go.uber.org/zap" ) // RaftEngine records all raft information. diff --git a/tools/pd-simulator/simulator/simutil/key.go b/tools/pd-simulator/simulator/simutil/key.go index a095f9d567b..ba1a19382ed 100644 --- a/tools/pd-simulator/simulator/simutil/key.go +++ b/tools/pd-simulator/simulator/simutil/key.go @@ -18,6 +18,7 @@ import ( "bytes" "github.com/pingcap/errors" + "github.com/tikv/pd/pkg/codec" ) diff --git a/tools/pd-simulator/simulator/simutil/key_test.go b/tools/pd-simulator/simulator/simutil/key_test.go index be07037501f..23cc0720b6b 100644 --- a/tools/pd-simulator/simulator/simutil/key_test.go +++ b/tools/pd-simulator/simulator/simutil/key_test.go @@ -17,8 +17,10 @@ package simutil import ( "testing" - "github.com/pingcap/kvproto/pkg/metapb" "github.com/stretchr/testify/require" + + "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/codec" "github.com/tikv/pd/pkg/core" ) diff --git a/tools/pd-simulator/simulator/simutil/logger.go b/tools/pd-simulator/simulator/simutil/logger.go index e22124f00a5..08bd0e0461f 100644 --- a/tools/pd-simulator/simulator/simutil/logger.go +++ b/tools/pd-simulator/simulator/simutil/logger.go @@ -15,8 +15,9 @@ package simutil import ( - "github.com/pingcap/log" "go.uber.org/zap" + + "github.com/pingcap/log" ) // Logger is the global logger used for simulator. diff --git a/tools/pd-simulator/simulator/task.go b/tools/pd-simulator/simulator/task.go index 0921838c70b..187f08fec68 100644 --- a/tools/pd-simulator/simulator/task.go +++ b/tools/pd-simulator/simulator/task.go @@ -21,13 +21,15 @@ import ( "time" "github.com/docker/go-units" + "go.uber.org/zap" + "github.com/pingcap/kvproto/pkg/eraftpb" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/tools/pd-analysis/analysis" "github.com/tikv/pd/tools/pd-simulator/simulator/simutil" - "go.uber.org/zap" ) const ( diff --git a/tools/pd-tso-bench/main.go b/tools/pd-tso-bench/main.go index ccb68a1c5fb..cd710470db5 100644 --- a/tools/pd-tso-bench/main.go +++ b/tools/pd-tso-bench/main.go @@ -29,15 +29,17 @@ import ( "time" "github.com/influxdata/tdigest" + "github.com/prometheus/client_golang/prometheus/promhttp" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/keepalive" + "github.com/pingcap/errors" "github.com/pingcap/log" - "github.com/prometheus/client_golang/prometheus/promhttp" + pd "github.com/tikv/pd/client" "github.com/tikv/pd/client/opt" "github.com/tikv/pd/client/pkg/caller" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/keepalive" ) const ( diff --git a/tools/pd-ut/alloc/check_env_linux.go b/tools/pd-ut/alloc/check_env_linux.go index 1a51f8075cf..c4d20bf6a65 100644 --- a/tools/pd-ut/alloc/check_env_linux.go +++ b/tools/pd-ut/alloc/check_env_linux.go @@ -18,8 +18,9 @@ package alloc import ( "github.com/cakturk/go-netstat/netstat" - "github.com/pingcap/log" "go.uber.org/zap" + + "github.com/pingcap/log" ) func environmentCheck(addr string) bool { diff --git a/tools/pd-ut/alloc/server.go b/tools/pd-ut/alloc/server.go index ffa3bce0aa5..6e7aeeb6307 100644 --- a/tools/pd-ut/alloc/server.go +++ b/tools/pd-ut/alloc/server.go @@ -23,9 +23,11 @@ import ( "time" "github.com/gin-gonic/gin" + "go.uber.org/zap" + "github.com/pingcap/log" + "github.com/tikv/pd/pkg/utils/tempurl" - "go.uber.org/zap" ) var statusAddress = flag.String("status-addr", "0.0.0.0:0", "status address") diff --git a/tools/pd-ut/alloc/tempurl.go b/tools/pd-ut/alloc/tempurl.go index 2131699133a..c7492064ac2 100644 --- a/tools/pd-ut/alloc/tempurl.go +++ b/tools/pd-ut/alloc/tempurl.go @@ -21,6 +21,7 @@ import ( "time" "github.com/pingcap/log" + "github.com/tikv/pd/pkg/errs" ) diff --git a/tools/pd-ut/ut.go b/tools/pd-ut/ut.go index 7bb0cf17e9f..8efacf5933a 100644 --- a/tools/pd-ut/ut.go +++ b/tools/pd-ut/ut.go @@ -33,9 +33,10 @@ import ( "sync" "time" - "github.com/tikv/pd/tools/pd-ut/alloc" "go.uber.org/zap" + "github.com/tikv/pd/tools/pd-ut/alloc" + // Set the correct value when it runs inside docker. _ "go.uber.org/automaxprocs" ) diff --git a/tools/regions-dump/main.go b/tools/regions-dump/main.go index 5ae4241cdc0..58d19ce72f2 100644 --- a/tools/regions-dump/main.go +++ b/tools/regions-dump/main.go @@ -25,12 +25,14 @@ import ( "strings" "time" + "go.etcd.io/etcd/client/pkg/v3/transport" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/etcdutil" - "go.etcd.io/etcd/client/pkg/v3/transport" - clientv3 "go.etcd.io/etcd/client/v3" ) var ( diff --git a/tools/stores-dump/main.go b/tools/stores-dump/main.go index 0409244772f..0815c6e7113 100644 --- a/tools/stores-dump/main.go +++ b/tools/stores-dump/main.go @@ -25,11 +25,13 @@ import ( "strings" "time" + "go.etcd.io/etcd/client/pkg/v3/transport" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/tikv/pd/pkg/utils/etcdutil" - "go.etcd.io/etcd/client/pkg/v3/transport" - clientv3 "go.etcd.io/etcd/client/v3" ) var (