From f67ec107793bb17b04e176dbaa9e8cbfb09adda9 Mon Sep 17 00:00:00 2001 From: demoManito <1430482733@qq.com> Date: Tue, 20 Sep 2022 11:06:33 +0800 Subject: [PATCH] etcd: format import order golang CodeReviewComments: https://github.com/golang/go/wiki/CodeReviewComments#imports Signed-off-by: demoManito <1430482733@qq.com> --- client/v2/README.md | 10 +++++----- client/v3/kv.go | 6 +++--- client/v3/retry_interceptor_test.go | 6 ++++-- contrib/raftexample/raft_test.go | 3 ++- server/etcdserver/api/v3discovery/discovery.go | 7 +++---- server/etcdserver/api/v3rpc/key_test.go | 3 ++- tests/integration/v3_failover_test.go | 9 +++++---- 7 files changed, 24 insertions(+), 20 deletions(-) diff --git a/client/v2/README.md b/client/v2/README.md index 5ecb67820..9ec7d86ec 100644 --- a/client/v2/README.md +++ b/client/v2/README.md @@ -18,11 +18,11 @@ go get go.etcd.io/etcd/v3/client package main import ( - "log" - "time" - "context" - - "go.etcd.io/etcd/v3/client" + "context" + "log" + "time" + + "go.etcd.io/etcd/v3/client" ) func main() { diff --git a/client/v3/kv.go b/client/v3/kv.go index 80cd80af1..f50f9595c 100644 --- a/client/v3/kv.go +++ b/client/v3/kv.go @@ -16,11 +16,11 @@ package clientv3 import ( "context" - "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - - pb "go.etcd.io/etcd/api/v3/etcdserverpb" "google.golang.org/grpc" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" ) type ( diff --git a/client/v3/retry_interceptor_test.go b/client/v3/retry_interceptor_test.go index b850b56e0..4932781f2 100644 --- a/client/v3/retry_interceptor_test.go +++ b/client/v3/retry_interceptor_test.go @@ -1,10 +1,12 @@ package clientv3 import ( + "testing" + + grpccredentials "google.golang.org/grpc/credentials" + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/client/v3/credentials" - grpccredentials "google.golang.org/grpc/credentials" - "testing" ) type dummyAuthTokenBundle struct{} diff --git a/contrib/raftexample/raft_test.go b/contrib/raftexample/raft_test.go index 53d9ad2f7..f1d45c256 100644 --- a/contrib/raftexample/raft_test.go +++ b/contrib/raftexample/raft_test.go @@ -15,9 +15,10 @@ package main import ( - "go.etcd.io/etcd/raft/v3/raftpb" "reflect" "testing" + + "go.etcd.io/etcd/raft/v3/raftpb" ) func TestProcessMessages(t *testing.T) { diff --git a/server/etcdserver/api/v3discovery/discovery.go b/server/etcdserver/api/v3discovery/discovery.go index f5be6b8f7..9d6f03cec 100644 --- a/server/etcdserver/api/v3discovery/discovery.go +++ b/server/etcdserver/api/v3discovery/discovery.go @@ -19,7 +19,6 @@ package v3discovery import ( "context" "errors" - "math" "path" "sort" @@ -27,11 +26,11 @@ import ( "strings" "time" - "go.etcd.io/etcd/client/pkg/v3/types" - "go.etcd.io/etcd/client/v3" - "github.com/jonboulle/clockwork" "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/types" + clientv3 "go.etcd.io/etcd/client/v3" ) const ( diff --git a/server/etcdserver/api/v3rpc/key_test.go b/server/etcdserver/api/v3rpc/key_test.go index 87e025fe0..a585ee89c 100644 --- a/server/etcdserver/api/v3rpc/key_test.go +++ b/server/etcdserver/api/v3rpc/key_test.go @@ -15,9 +15,10 @@ package v3rpc import ( + "testing" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - "testing" ) func TestCheckRangeRequest(t *testing.T) { diff --git a/tests/integration/v3_failover_test.go b/tests/integration/v3_failover_test.go index 8fa8dfa16..9d271bd9f 100644 --- a/tests/integration/v3_failover_test.go +++ b/tests/integration/v3_failover_test.go @@ -18,14 +18,15 @@ import ( "bytes" "context" "crypto/tls" - "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - clientv3test "go.etcd.io/etcd/tests/v3/integration/clientv3" "testing" "time" - "go.etcd.io/etcd/client/v3" - integration2 "go.etcd.io/etcd/tests/v3/framework/integration" "google.golang.org/grpc" + + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" + clientv3 "go.etcd.io/etcd/client/v3" + integration2 "go.etcd.io/etcd/tests/v3/framework/integration" + clientv3test "go.etcd.io/etcd/tests/v3/integration/clientv3" ) func TestFailover(t *testing.T) {