diff --git a/Makefile b/Makefile index 902214e3fbd..bc7b3f3d92b 100644 --- a/Makefile +++ b/Makefile @@ -64,9 +64,9 @@ fuzz: verify: verify-gofmt verify-bom verify-lint verify-dep verify-shellcheck verify-goword \ verify-govet verify-license-header verify-receiver-name verify-mod-tidy verify-shellcheck \ - verify-shellws verify-proto-annotations verify-genproto verify-goimport verify-yamllint \ + verify-shellws verify-proto-annotations verify-genproto verify-yamllint \ verify-govet-shadow -fix: fix-goimports fix-bom fix-lint fix-yamllint +fix: fix-bom fix-lint fix-yamllint ./scripts/fix.sh .PHONY: verify-gofmt @@ -91,7 +91,7 @@ verify-lint: .PHONY: fix-lint fix-lint: - golangci-lint run --config tools/.golangci.yaml --fix + PASSES="lint_fix" ./scripts/test.sh .PHONY: verify-shellcheck verify-shellcheck: @@ -129,14 +129,6 @@ verify-proto-annotations: verify-genproto: PASSES="genproto" ./scripts/test.sh -.PHONY: verify-goimport -verify-goimport: - PASSES="goimport" ./scripts/test.sh - -.PHONY: fix-goimports -fix-goimports: - ./scripts/fix-goimports.sh - .PHONY: verify-yamllint verify-yamllint: yamllint --config-file tools/.yamllint . diff --git a/client/pkg/logutil/zap_journal.go b/client/pkg/logutil/zap_journal.go index c6adc010381..06dc40dacd9 100644 --- a/client/pkg/logutil/zap_journal.go +++ b/client/pkg/logutil/zap_journal.go @@ -24,10 +24,10 @@ import ( "os" "path/filepath" - "go.etcd.io/etcd/client/pkg/v3/systemd" - "github.com/coreos/go-systemd/v22/journal" "go.uber.org/zap/zapcore" + + "go.etcd.io/etcd/client/pkg/v3/systemd" ) // NewJournalWriter wraps "io.Writer" to redirect log output diff --git a/client/pkg/transport/listener.go b/client/pkg/transport/listener.go index 314a736044b..a5ec1342331 100644 --- a/client/pkg/transport/listener.go +++ b/client/pkg/transport/listener.go @@ -32,11 +32,11 @@ import ( "strings" "time" + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/client/pkg/v3/tlsutil" "go.etcd.io/etcd/client/pkg/v3/verify" - - "go.uber.org/zap" ) // NewListener creates a new listner. diff --git a/client/v3/client_test.go b/client/v3/client_test.go index f81a1c102bc..350b1960a10 100644 --- a/client/v3/client_test.go +++ b/client/v3/client_test.go @@ -27,16 +27,14 @@ import ( "github.com/coreos/go-semver/semver" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.uber.org/zap" "go.uber.org/zap/zaptest" + "google.golang.org/grpc" "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/testutil" - - "google.golang.org/grpc" ) func NewClient(t *testing.T, cfg Config) (*Client, error) { diff --git a/client/v3/cluster.go b/client/v3/cluster.go index e4bfbad815f..faab2a1add5 100644 --- a/client/v3/cluster.go +++ b/client/v3/cluster.go @@ -17,10 +17,10 @@ package clientv3 import ( "context" + "google.golang.org/grpc" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/types" - - "google.golang.org/grpc" ) type ( diff --git a/client/v3/lease.go b/client/v3/lease.go index e51e7b0d6dc..85703b1a0e3 100644 --- a/client/v3/lease.go +++ b/client/v3/lease.go @@ -19,12 +19,12 @@ import ( "sync" "time" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/metadata" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" ) type ( diff --git a/client/v3/leasing/kv.go b/client/v3/leasing/kv.go index f0cded20fea..35792f42086 100644 --- a/client/v3/leasing/kv.go +++ b/client/v3/leasing/kv.go @@ -20,14 +20,14 @@ import ( "sync" "time" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/mvccpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" v3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) type leasingKV struct { diff --git a/client/v3/mock/mockserver/mockserver.go b/client/v3/mock/mockserver/mockserver.go index 837d45db175..59a95388bf0 100644 --- a/client/v3/mock/mockserver/mockserver.go +++ b/client/v3/mock/mockserver/mockserver.go @@ -21,10 +21,10 @@ import ( "os" "sync" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "google.golang.org/grpc" "google.golang.org/grpc/resolver" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" ) // MockServer provides a mocked out grpc server of the etcdserver interface. diff --git a/client/v3/naming/endpoints/endpoints_impl.go b/client/v3/naming/endpoints/endpoints_impl.go index f88a3eed13f..5193d986751 100644 --- a/client/v3/naming/endpoints/endpoints_impl.go +++ b/client/v3/naming/endpoints/endpoints_impl.go @@ -22,12 +22,12 @@ import ( "errors" "strings" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/client/v3/naming/endpoints/internal" - "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/client/v3/naming/endpoints/internal" ) type endpointManager struct { diff --git a/client/v3/naming/resolver/resolver.go b/client/v3/naming/resolver/resolver.go index 7b9f61d2e08..f42b2b0b6e7 100644 --- a/client/v3/naming/resolver/resolver.go +++ b/client/v3/naming/resolver/resolver.go @@ -19,12 +19,12 @@ import ( "strings" "sync" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/client/v3/naming/endpoints" - "google.golang.org/grpc/codes" gresolver "google.golang.org/grpc/resolver" "google.golang.org/grpc/status" + + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/client/v3/naming/endpoints" ) type builder struct { diff --git a/client/v3/retry.go b/client/v3/retry.go index 69ecc631471..e56e061340d 100644 --- a/client/v3/retry.go +++ b/client/v3/retry.go @@ -17,12 +17,12 @@ package clientv3 import ( "context" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" ) type retryPolicy uint8 diff --git a/client/v3/txn.go b/client/v3/txn.go index 3f6a953cf09..a4e3706fa96 100644 --- a/client/v3/txn.go +++ b/client/v3/txn.go @@ -18,9 +18,9 @@ import ( "context" "sync" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "google.golang.org/grpc" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" ) // Txn is the interface that wraps mini-transactions. diff --git a/etcdctl/ctlv3/command/check.go b/etcdctl/ctlv3/command/check.go index 24b675c7ba6..66b9f906d97 100644 --- a/etcdctl/ctlv3/command/check.go +++ b/etcdctl/ctlv3/command/check.go @@ -26,13 +26,13 @@ import ( "sync" "time" - v3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/pkg/v3/cobrautl" - "go.etcd.io/etcd/pkg/v3/report" - "github.com/cheggaaa/pb/v3" "github.com/spf13/cobra" "golang.org/x/time/rate" + + v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" + "go.etcd.io/etcd/pkg/v3/report" ) var ( diff --git a/etcdctl/ctlv3/command/elect_command.go b/etcdctl/ctlv3/command/elect_command.go index 14feb13f5bf..2e9a32b3f0d 100644 --- a/etcdctl/ctlv3/command/elect_command.go +++ b/etcdctl/ctlv3/command/elect_command.go @@ -21,11 +21,11 @@ import ( "os/signal" "syscall" + "github.com/spf13/cobra" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/spf13/cobra" ) var ( diff --git a/etcdctl/ctlv3/command/ep_command.go b/etcdctl/ctlv3/command/ep_command.go index 1a9a529cc4c..2fb017c1fd0 100644 --- a/etcdctl/ctlv3/command/ep_command.go +++ b/etcdctl/ctlv3/command/ep_command.go @@ -20,15 +20,15 @@ import ( "sync" "time" + "github.com/spf13/cobra" + "go.uber.org/zap" + "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/client/pkg/v3/logutil" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/pkg/v3/cobrautl" "go.etcd.io/etcd/pkg/v3/flags" - - "github.com/spf13/cobra" - "go.uber.org/zap" ) var epClusterEndpoints bool diff --git a/etcdctl/ctlv3/command/global.go b/etcdctl/ctlv3/command/global.go index 6997b94bdb6..93b62068af6 100644 --- a/etcdctl/ctlv3/command/global.go +++ b/etcdctl/ctlv3/command/global.go @@ -23,6 +23,10 @@ import ( "time" "github.com/bgentry/speakeasy" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "go.uber.org/zap" + "google.golang.org/grpc/grpclog" "go.etcd.io/etcd/client/pkg/v3/logutil" "go.etcd.io/etcd/client/pkg/v3/srv" @@ -30,11 +34,6 @@ import ( clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/pkg/v3/cobrautl" "go.etcd.io/etcd/pkg/v3/flags" - - "github.com/spf13/cobra" - "github.com/spf13/pflag" - "go.uber.org/zap" - "google.golang.org/grpc/grpclog" ) // GlobalFlags are flags that defined globally diff --git a/etcdctl/ctlv3/command/lease_command.go b/etcdctl/ctlv3/command/lease_command.go index 97cacdfaf30..e8aa2841071 100644 --- a/etcdctl/ctlv3/command/lease_command.go +++ b/etcdctl/ctlv3/command/lease_command.go @@ -19,10 +19,10 @@ import ( "fmt" "strconv" + "github.com/spf13/cobra" + v3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/spf13/cobra" ) // NewLeaseCommand returns the cobra command for "lease". diff --git a/etcdctl/ctlv3/command/lock_command.go b/etcdctl/ctlv3/command/lock_command.go index 0a3d866cdbc..1522773c21a 100644 --- a/etcdctl/ctlv3/command/lock_command.go +++ b/etcdctl/ctlv3/command/lock_command.go @@ -23,11 +23,11 @@ import ( "os/signal" "syscall" + "github.com/spf13/cobra" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/spf13/cobra" ) var lockTTL = 10 diff --git a/etcdctl/ctlv3/command/make_mirror_command.go b/etcdctl/ctlv3/command/make_mirror_command.go index 1665330e835..b5051ccf54f 100644 --- a/etcdctl/ctlv3/command/make_mirror_command.go +++ b/etcdctl/ctlv3/command/make_mirror_command.go @@ -23,15 +23,13 @@ import ( "time" "github.com/bgentry/speakeasy" - - "go.etcd.io/etcd/pkg/v3/cobrautl" + "github.com/spf13/cobra" "go.etcd.io/etcd/api/v3/mvccpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/mirror" - - "github.com/spf13/cobra" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) const ( diff --git a/etcdctl/ctlv3/command/printer.go b/etcdctl/ctlv3/command/printer.go index 368ec981f6f..a7b9fb6a76e 100644 --- a/etcdctl/ctlv3/command/printer.go +++ b/etcdctl/ctlv3/command/printer.go @@ -19,11 +19,11 @@ import ( "fmt" "strings" + "github.com/dustin/go-humanize" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" v3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/dustin/go-humanize" ) type printer interface { diff --git a/etcdctl/ctlv3/command/printer_table.go b/etcdctl/ctlv3/command/printer_table.go index 2bc6cfcf603..b617744649f 100644 --- a/etcdctl/ctlv3/command/printer_table.go +++ b/etcdctl/ctlv3/command/printer_table.go @@ -17,9 +17,9 @@ package command import ( "os" - v3 "go.etcd.io/etcd/client/v3" - "github.com/olekukonko/tablewriter" + + v3 "go.etcd.io/etcd/client/v3" ) type tablePrinter struct{ printer } diff --git a/etcdctl/ctlv3/command/txn_command.go b/etcdctl/ctlv3/command/txn_command.go index 3efbab919f5..a898430d15a 100644 --- a/etcdctl/ctlv3/command/txn_command.go +++ b/etcdctl/ctlv3/command/txn_command.go @@ -22,11 +22,11 @@ import ( "strconv" "strings" + "github.com/spf13/cobra" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/spf13/cobra" ) var txnInteractive bool diff --git a/etcdctl/ctlv3/command/util.go b/etcdctl/ctlv3/command/util.go index 479c915500f..03ba24ccf94 100644 --- a/etcdctl/ctlv3/command/util.go +++ b/etcdctl/ctlv3/command/util.go @@ -26,11 +26,11 @@ import ( "strings" "time" + "github.com/spf13/cobra" + pb "go.etcd.io/etcd/api/v3/mvccpb" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/spf13/cobra" ) func printKV(isHex bool, valueOnly bool, kv *pb.KeyValue) { diff --git a/etcdctl/ctlv3/command/version_command.go b/etcdctl/ctlv3/command/version_command.go index b65c299048b..e57567d6a3d 100644 --- a/etcdctl/ctlv3/command/version_command.go +++ b/etcdctl/ctlv3/command/version_command.go @@ -17,9 +17,9 @@ package command import ( "fmt" - "go.etcd.io/etcd/api/v3/version" - "github.com/spf13/cobra" + + "go.etcd.io/etcd/api/v3/version" ) // NewVersionCommand prints out the version of etcd. diff --git a/etcdctl/ctlv3/command/watch_command.go b/etcdctl/ctlv3/command/watch_command.go index d8592cb4e77..04313ce543d 100644 --- a/etcdctl/ctlv3/command/watch_command.go +++ b/etcdctl/ctlv3/command/watch_command.go @@ -23,10 +23,10 @@ import ( "os/exec" "strings" + "github.com/spf13/cobra" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/spf13/cobra" ) var ( diff --git a/etcdctl/ctlv3/ctl.go b/etcdctl/ctlv3/ctl.go index 6d3abfb3d94..4f9c31055c0 100644 --- a/etcdctl/ctlv3/ctl.go +++ b/etcdctl/ctlv3/ctl.go @@ -19,11 +19,11 @@ import ( "os" "time" + "github.com/spf13/cobra" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/etcdctl/v3/ctlv3/command" "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/spf13/cobra" ) const ( diff --git a/etcdutl/etcdutl/backup_command.go b/etcdutl/etcdutl/backup_command.go index 155e655069e..950e315e364 100644 --- a/etcdutl/etcdutl/backup_command.go +++ b/etcdutl/etcdutl/backup_command.go @@ -23,6 +23,7 @@ import ( "github.com/spf13/cobra" "go.uber.org/zap" + bolt "go.etcd.io/bbolt" "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/client/pkg/v3/types" @@ -38,8 +39,6 @@ import ( "go.etcd.io/etcd/server/v3/storage/wal/walpb" "go.etcd.io/etcd/server/v3/verify" "go.etcd.io/raft/v3/raftpb" - - bolt "go.etcd.io/bbolt" ) var ( diff --git a/etcdutl/etcdutl/printer.go b/etcdutl/etcdutl/printer.go index ae8996e0ea6..540a7efa99a 100644 --- a/etcdutl/etcdutl/printer.go +++ b/etcdutl/etcdutl/printer.go @@ -18,12 +18,11 @@ import ( "errors" "fmt" + "github.com/dustin/go-humanize" "github.com/spf13/cobra" "go.etcd.io/etcd/etcdutl/v3/snapshot" "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/dustin/go-humanize" ) var ( diff --git a/etcdutl/etcdutl/printer_table.go b/etcdutl/etcdutl/printer_table.go index 2f8f81d4e6a..34f0ad79a64 100644 --- a/etcdutl/etcdutl/printer_table.go +++ b/etcdutl/etcdutl/printer_table.go @@ -17,9 +17,9 @@ package etcdutl import ( "os" - "go.etcd.io/etcd/etcdutl/v3/snapshot" - "github.com/olekukonko/tablewriter" + + "go.etcd.io/etcd/etcdutl/v3/snapshot" ) type tablePrinter struct{ printer } diff --git a/etcdutl/etcdutl/snapshot_command.go b/etcdutl/etcdutl/snapshot_command.go index ea0d9bfc2c7..9e557495e5c 100644 --- a/etcdutl/etcdutl/snapshot_command.go +++ b/etcdutl/etcdutl/snapshot_command.go @@ -18,11 +18,11 @@ import ( "fmt" "strings" + "github.com/spf13/cobra" + "go.etcd.io/etcd/etcdutl/v3/snapshot" "go.etcd.io/etcd/pkg/v3/cobrautl" "go.etcd.io/etcd/server/v3/storage/datadir" - - "github.com/spf13/cobra" ) const ( diff --git a/etcdutl/etcdutl/version_command.go b/etcdutl/etcdutl/version_command.go index 1cb1a146b4b..a8ecd3e6a4c 100644 --- a/etcdutl/etcdutl/version_command.go +++ b/etcdutl/etcdutl/version_command.go @@ -17,9 +17,9 @@ package etcdutl import ( "fmt" - "go.etcd.io/etcd/api/v3/version" - "github.com/spf13/cobra" + + "go.etcd.io/etcd/api/v3/version" ) // NewVersionCommand prints out the version of etcd. diff --git a/pkg/netutil/netutil.go b/pkg/netutil/netutil.go index 689927b4c67..d4e2515d8bc 100644 --- a/pkg/netutil/netutil.go +++ b/pkg/netutil/netutil.go @@ -23,9 +23,9 @@ import ( "sort" "time" - "go.etcd.io/etcd/client/pkg/v3/types" - "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/types" ) // indirection for testing diff --git a/pkg/proxy/server.go b/pkg/proxy/server.go index 96f30bd7d4a..6d7931b4e33 100644 --- a/pkg/proxy/server.go +++ b/pkg/proxy/server.go @@ -27,10 +27,10 @@ import ( "sync" "time" - "go.etcd.io/etcd/client/pkg/v3/transport" - humanize "github.com/dustin/go-humanize" "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/transport" ) var ( diff --git a/pkg/schedule/schedule.go b/pkg/schedule/schedule.go index ea19cf0181b..06a243df914 100644 --- a/pkg/schedule/schedule.go +++ b/pkg/schedule/schedule.go @@ -18,9 +18,9 @@ import ( "context" "sync" - "go.etcd.io/etcd/client/pkg/v3/verify" - "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/verify" ) type Job interface { diff --git a/scripts/fix-goimports.sh b/scripts/fix-goimports.sh deleted file mode 100755 index 2f1022186d2..00000000000 --- a/scripts/fix-goimports.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -source ./scripts/test_lib.sh - -ROOTDIR=$(pwd) - -# To fix according to newer version of go: -# go get golang.org/dl/gotip -# gotip download -# GO_CMD="gotip" -GO_CMD="go" - -ROOTDIR=$(pwd) - -function go_imports_fix { - GOFILES=$(run ${GO_CMD} list --f "{{with \$d:=.}}{{range .GoFiles}}{{\$d.Dir}}/{{.}}{{\"\n\"}}{{end}}{{end}}" ./...) - TESTGOFILES=$(run ${GO_CMD} list --f "{{with \$d:=.}}{{range .TestGoFiles}}{{\$d.Dir}}/{{.}}{{\"\n\"}}{{end}}{{end}}" ./...) - cd "${ROOTDIR}/tools/mod" - echo "${GOFILES}" "${TESTGOFILES}" | grep -v '.gw.go' | grep -v '.pb.go' | xargs -n 100 go run golang.org/x/tools/cmd/goimports -w -local go.etcd.io -} - -log_callout -e "\\nFixing goimports for you...\n" - -run_for_modules go_imports_fix || exit 2 - -log_success -e "\\nSUCCESS: goimports are fixed :)" diff --git a/scripts/test.sh b/scripts/test.sh index ded0d818479..16449910852 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -429,6 +429,10 @@ function lint_pass { run_for_modules generic_checker run golangci-lint run --config "${ETCD_ROOT_DIR}/tools/.golangci.yaml" } +function lint_fix_pass { + run_for_modules generic_checker run golangci-lint run --config "${ETCD_ROOT_DIR}/tools/.golangci.yaml" --fix +} + function revive_pass { # TODO: etcdserverpb/raft_internal_stringer.go:15:1: should have a package comment run_for_modules generic_checker run_go_tool "github.com/mgechev/revive" -config "${ETCD_ROOT_DIR}/tests/revive.toml" -exclude "vendor/..." -exclude "out/..." @@ -671,21 +675,6 @@ function genproto_pass { "${ETCD_ROOT_DIR}/scripts/verify_genproto.sh" } -function goimport_for_module { - GOFILES=$(run go list --f "{{with \$d:=.}}{{range .GoFiles}}{{\$d.Dir}}/{{.}}{{\"\n\"}}{{end}}{{end}}" ./...) || return 2 - TESTGOFILES=$(run go list --f "{{with \$d:=.}}{{range .TestGoFiles}}{{\$d.Dir}}/{{.}}{{\"\n\"}}{{end}}{{end}}" ./...) || return 2 - cd "${ETCD_ROOT_DIR}/tools/mod" - FILESNEEDSFIX=$(echo "${GOFILES}" "${TESTGOFILES}" | grep -v '.gw.go' | grep -v '.pb.go' | xargs -n 100 go run golang.org/x/tools/cmd/goimports -l -local go.etcd.io) - if [ -n "$FILESNEEDSFIX" ]; then - log_error -e "the following files are not sync with 'goimports'. run 'make fix'\\n$FILESNEEDSFIX" - return 255 - fi -} - -function goimport_pass { - run_for_modules goimport_for_module -} - ########### MAIN ############################################################### function run_pass { diff --git a/server/auth/store.go b/server/auth/store.go index f272112884d..ba93e4b7d20 100644 --- a/server/auth/store.go +++ b/server/auth/store.go @@ -25,15 +25,15 @@ import ( "sync/atomic" "time" - "go.etcd.io/etcd/api/v3/authpb" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - "go.uber.org/zap" "golang.org/x/crypto/bcrypt" "google.golang.org/grpc/credentials" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" + + "go.etcd.io/etcd/api/v3/authpb" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" ) var ( diff --git a/server/auth/store_test.go b/server/auth/store_test.go index b3b160e633b..a05102f652f 100644 --- a/server/auth/store_test.go +++ b/server/auth/store_test.go @@ -26,7 +26,6 @@ import ( "github.com/stretchr/testify/assert" "go.uber.org/zap/zaptest" - "golang.org/x/crypto/bcrypt" "google.golang.org/grpc/metadata" diff --git a/server/config/config.go b/server/config/config.go index 48de650b8a1..057f78b6f9f 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -25,13 +25,12 @@ import ( "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "go.uber.org/zap" + bolt "go.etcd.io/bbolt" "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/pkg/v3/netutil" "go.etcd.io/etcd/server/v3/etcdserver/api/v3discovery" "go.etcd.io/etcd/server/v3/storage/datadir" - - bolt "go.etcd.io/bbolt" ) // ServerConfig holds the configuration of etcd as taken from the command line or discovery. diff --git a/server/embed/config.go b/server/embed/config.go index 0b79ce4bc25..62ff9d1bf93 100644 --- a/server/embed/config.go +++ b/server/embed/config.go @@ -28,6 +28,13 @@ import ( "sync" "time" + "go.uber.org/multierr" + "go.uber.org/zap" + "golang.org/x/crypto/bcrypt" + "google.golang.org/grpc" + "sigs.k8s.io/yaml" + + bolt "go.etcd.io/bbolt" "go.etcd.io/etcd/client/pkg/v3/logutil" "go.etcd.io/etcd/client/pkg/v3/srv" "go.etcd.io/etcd/client/pkg/v3/tlsutil" @@ -41,14 +48,6 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver/api/membership" "go.etcd.io/etcd/server/v3/etcdserver/api/v3compactor" "go.etcd.io/etcd/server/v3/etcdserver/api/v3discovery" - - "go.uber.org/multierr" - "go.uber.org/zap" - "golang.org/x/crypto/bcrypt" - "google.golang.org/grpc" - "sigs.k8s.io/yaml" - - bolt "go.etcd.io/bbolt" ) const ( diff --git a/server/embed/config_logging_journal_unix.go b/server/embed/config_logging_journal_unix.go index 75d83ff2b55..d53269547eb 100644 --- a/server/embed/config_logging_journal_unix.go +++ b/server/embed/config_logging_journal_unix.go @@ -20,9 +20,9 @@ import ( "fmt" "os" - "go.etcd.io/etcd/client/pkg/v3/logutil" - "go.uber.org/zap/zapcore" + + "go.etcd.io/etcd/client/pkg/v3/logutil" ) // use stderr as fallback diff --git a/server/embed/config_test.go b/server/embed/config_test.go index e4e92744f43..8073a1085ec 100644 --- a/server/embed/config_test.go +++ b/server/embed/config_test.go @@ -26,12 +26,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "sigs.k8s.io/yaml" "go.etcd.io/etcd/client/pkg/v3/srv" "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/pkg/v3/types" - - "sigs.k8s.io/yaml" ) func notFoundErr(service, domain string) error { diff --git a/server/embed/etcd.go b/server/embed/etcd.go index c0c6762a6f7..188d73f4496 100644 --- a/server/embed/etcd.go +++ b/server/embed/etcd.go @@ -31,6 +31,13 @@ import ( "sync" "time" + grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" + "github.com/soheilhy/cmux" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/keepalive" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/pkg/v3/types" @@ -43,13 +50,6 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp" "go.etcd.io/etcd/server/v3/storage" "go.etcd.io/etcd/server/v3/verify" - - grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - "github.com/soheilhy/cmux" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/keepalive" ) const ( diff --git a/server/embed/serve.go b/server/embed/serve.go index 5998371842c..4a190db7465 100644 --- a/server/embed/serve.go +++ b/server/embed/serve.go @@ -24,6 +24,15 @@ import ( "strings" "time" + gw "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/soheilhy/cmux" + "github.com/tmc/grpc-websocket-proxy/wsproxy" + "go.uber.org/zap" + "golang.org/x/net/http2" + "golang.org/x/net/trace" + "google.golang.org/grpc" + "google.golang.org/protobuf/encoding/protojson" + etcdservergw "go.etcd.io/etcd/api/v3/etcdserverpb/gw" "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/pkg/v3/debugutil" @@ -38,15 +47,6 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb" v3lockgw "go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb/gw" "go.etcd.io/etcd/server/v3/etcdserver/api/v3rpc" - - gw "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/soheilhy/cmux" - "github.com/tmc/grpc-websocket-proxy/wsproxy" - "go.uber.org/zap" - "golang.org/x/net/http2" - "golang.org/x/net/trace" - "google.golang.org/grpc" - "google.golang.org/protobuf/encoding/protojson" ) type serveCtx struct { diff --git a/server/etcdmain/config.go b/server/etcdmain/config.go index fa5d6d161a1..2a7d54405fc 100644 --- a/server/etcdmain/config.go +++ b/server/etcdmain/config.go @@ -24,6 +24,8 @@ import ( "runtime" "time" + "go.uber.org/zap" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/logutil" "go.etcd.io/etcd/client/pkg/v3/tlsutil" @@ -32,8 +34,6 @@ import ( "go.etcd.io/etcd/server/v3/embed" "go.etcd.io/etcd/server/v3/etcdserver/api/membership" "go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp" - - "go.uber.org/zap" ) var ( diff --git a/server/etcdmain/gateway.go b/server/etcdmain/gateway.go index 64fb90df2c1..3f5774f573f 100644 --- a/server/etcdmain/gateway.go +++ b/server/etcdmain/gateway.go @@ -21,11 +21,11 @@ import ( "os" "time" - "go.etcd.io/etcd/client/pkg/v3/logutil" - "go.etcd.io/etcd/server/v3/proxy/tcpproxy" - "github.com/spf13/cobra" "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/logutil" + "go.etcd.io/etcd/server/v3/proxy/tcpproxy" ) var ( diff --git a/server/etcdmain/grpc_proxy.go b/server/etcdmain/grpc_proxy.go index c60be63c0f6..ecb041ecbe6 100644 --- a/server/etcdmain/grpc_proxy.go +++ b/server/etcdmain/grpc_proxy.go @@ -29,6 +29,19 @@ import ( "path/filepath" "time" + grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" + grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" + grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags" + grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" + "github.com/soheilhy/cmux" + "github.com/spf13/cobra" + "go.uber.org/zap" + "go.uber.org/zap/zapgrpc" + "golang.org/x/net/http2" + "google.golang.org/grpc" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/keepalive" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/logutil" "go.etcd.io/etcd/client/pkg/v3/tlsutil" @@ -42,19 +55,6 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver/api/v3election/v3electionpb" "go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb" "go.etcd.io/etcd/server/v3/proxy/grpcproxy" - - grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" - grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" - grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags" - grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - "github.com/soheilhy/cmux" - "github.com/spf13/cobra" - "go.uber.org/zap" - "go.uber.org/zap/zapgrpc" - "golang.org/x/net/http2" - "google.golang.org/grpc" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/keepalive" ) var ( diff --git a/server/etcdmain/util.go b/server/etcdmain/util.go index f133b575928..984592a2c49 100644 --- a/server/etcdmain/util.go +++ b/server/etcdmain/util.go @@ -18,10 +18,10 @@ import ( "fmt" "os" + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/srv" "go.etcd.io/etcd/client/pkg/v3/transport" - - "go.uber.org/zap" ) func discoverEndpoints(lg *zap.Logger, dns string, ca string, insecure bool, serviceName string) (s srv.SRVClients) { diff --git a/server/etcdserver/api/capability.go b/server/etcdserver/api/capability.go index 8546eeb543a..4cd9aca84b5 100644 --- a/server/etcdserver/api/capability.go +++ b/server/etcdserver/api/capability.go @@ -17,12 +17,11 @@ package api import ( "sync" + "github.com/coreos/go-semver/semver" "go.uber.org/zap" "go.etcd.io/etcd/api/v3/version" serverversion "go.etcd.io/etcd/server/v3/etcdserver/version" - - "github.com/coreos/go-semver/semver" ) type Capability string diff --git a/server/etcdserver/api/etcdhttp/peer.go b/server/etcdserver/api/etcdhttp/peer.go index a205eca65c4..e477f033c30 100644 --- a/server/etcdserver/api/etcdhttp/peer.go +++ b/server/etcdserver/api/etcdhttp/peer.go @@ -21,6 +21,8 @@ import ( "strconv" "strings" + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/etcdserver" "go.etcd.io/etcd/server/v3/etcdserver/api" @@ -28,8 +30,6 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp" "go.etcd.io/etcd/server/v3/etcdserver/errors" "go.etcd.io/etcd/server/v3/lease/leasehttp" - - "go.uber.org/zap" ) const ( diff --git a/server/etcdserver/api/etcdhttp/peer_test.go b/server/etcdserver/api/etcdhttp/peer_test.go index 1a2380a003d..9ed02f43962 100644 --- a/server/etcdserver/api/etcdhttp/peer_test.go +++ b/server/etcdserver/api/etcdhttp/peer_test.go @@ -26,9 +26,8 @@ import ( "strings" "testing" - "go.uber.org/zap/zaptest" - "github.com/coreos/go-semver/semver" + "go.uber.org/zap/zaptest" pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/testutil" diff --git a/server/etcdserver/api/membership/cluster.go b/server/etcdserver/api/membership/cluster.go index c8f04c9dd01..bcaf8e80366 100644 --- a/server/etcdserver/api/membership/cluster.go +++ b/server/etcdserver/api/membership/cluster.go @@ -25,6 +25,10 @@ import ( "sync" "time" + "github.com/coreos/go-semver/semver" + "github.com/prometheus/client_golang/prometheus" + "go.uber.org/zap" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/pkg/v3/netutil" @@ -33,10 +37,6 @@ import ( serverversion "go.etcd.io/etcd/server/v3/etcdserver/version" "go.etcd.io/raft/v3" "go.etcd.io/raft/v3/raftpb" - - "github.com/coreos/go-semver/semver" - "github.com/prometheus/client_golang/prometheus" - "go.uber.org/zap" ) // RaftCluster is a list of Members that belong to the same raft cluster diff --git a/server/etcdserver/api/membership/membership_test.go b/server/etcdserver/api/membership/membership_test.go index b2ec4b324ae..ca1e95da4a8 100644 --- a/server/etcdserver/api/membership/membership_test.go +++ b/server/etcdserver/api/membership/membership_test.go @@ -19,11 +19,10 @@ import ( "github.com/coreos/go-semver/semver" "github.com/stretchr/testify/assert" + "go.uber.org/zap" "go.etcd.io/etcd/client/pkg/v3/types" serverversion "go.etcd.io/etcd/server/v3/etcdserver/version" - - "go.uber.org/zap" ) func TestAddRemoveMember(t *testing.T) { diff --git a/server/etcdserver/api/membership/store.go b/server/etcdserver/api/membership/store.go index bee385b0603..8ada160b312 100644 --- a/server/etcdserver/api/membership/store.go +++ b/server/etcdserver/api/membership/store.go @@ -17,11 +17,11 @@ package membership import ( "path" - "go.etcd.io/etcd/client/pkg/v3/types" - "go.etcd.io/etcd/server/v3/etcdserver/version" - "github.com/coreos/go-semver/semver" "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/types" + "go.etcd.io/etcd/server/v3/etcdserver/version" ) type MembershipBackend interface { diff --git a/server/etcdserver/api/membership/storev2.go b/server/etcdserver/api/membership/storev2.go index faf38e2be7c..956b2ee21e4 100644 --- a/server/etcdserver/api/membership/storev2.go +++ b/server/etcdserver/api/membership/storev2.go @@ -19,12 +19,11 @@ import ( "fmt" "path" - "go.etcd.io/etcd/client/pkg/v3/types" - - "go.etcd.io/etcd/server/v3/etcdserver/api/v2store" - "github.com/coreos/go-semver/semver" "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/types" + "go.etcd.io/etcd/server/v3/etcdserver/api/v2store" ) const ( diff --git a/server/etcdserver/api/rafthttp/http.go b/server/etcdserver/api/rafthttp/http.go index c22e514ed12..e9d30eec107 100644 --- a/server/etcdserver/api/rafthttp/http.go +++ b/server/etcdserver/api/rafthttp/http.go @@ -24,14 +24,14 @@ import ( "strings" "time" + humanize "github.com/dustin/go-humanize" + "go.uber.org/zap" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/types" pioutil "go.etcd.io/etcd/pkg/v3/ioutil" "go.etcd.io/etcd/server/v3/etcdserver/api/snap" "go.etcd.io/raft/v3/raftpb" - - humanize "github.com/dustin/go-humanize" - "go.uber.org/zap" ) const ( diff --git a/server/etcdserver/api/rafthttp/peer.go b/server/etcdserver/api/rafthttp/peer.go index 11d17cacee8..c1e6ba12704 100644 --- a/server/etcdserver/api/rafthttp/peer.go +++ b/server/etcdserver/api/rafthttp/peer.go @@ -19,14 +19,14 @@ import ( "sync" "time" + "go.uber.org/zap" + "golang.org/x/time/rate" + "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/etcdserver/api/snap" stats "go.etcd.io/etcd/server/v3/etcdserver/api/v2stats" "go.etcd.io/raft/v3" "go.etcd.io/raft/v3/raftpb" - - "go.uber.org/zap" - "golang.org/x/time/rate" ) const ( diff --git a/server/etcdserver/api/rafthttp/peer_status.go b/server/etcdserver/api/rafthttp/peer_status.go index cad19b2fbce..01c3ebacfad 100644 --- a/server/etcdserver/api/rafthttp/peer_status.go +++ b/server/etcdserver/api/rafthttp/peer_status.go @@ -20,9 +20,9 @@ import ( "sync" "time" - "go.etcd.io/etcd/client/pkg/v3/types" - "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/types" ) type failureType struct { diff --git a/server/etcdserver/api/rafthttp/pipeline.go b/server/etcdserver/api/rafthttp/pipeline.go index 958d8def2ed..50b8c8dd3f1 100644 --- a/server/etcdserver/api/rafthttp/pipeline.go +++ b/server/etcdserver/api/rafthttp/pipeline.go @@ -23,13 +23,13 @@ import ( "sync" "time" + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/pkg/v3/pbutil" stats "go.etcd.io/etcd/server/v3/etcdserver/api/v2stats" "go.etcd.io/raft/v3" "go.etcd.io/raft/v3/raftpb" - - "go.uber.org/zap" ) const ( diff --git a/server/etcdserver/api/rafthttp/remote.go b/server/etcdserver/api/rafthttp/remote.go index f40acbb9802..3eb2f386806 100644 --- a/server/etcdserver/api/rafthttp/remote.go +++ b/server/etcdserver/api/rafthttp/remote.go @@ -15,10 +15,10 @@ package rafthttp import ( + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/raft/v3/raftpb" - - "go.uber.org/zap" ) type remote struct { diff --git a/server/etcdserver/api/rafthttp/snapshot_sender.go b/server/etcdserver/api/rafthttp/snapshot_sender.go index 9b98474fe00..1f0253f1465 100644 --- a/server/etcdserver/api/rafthttp/snapshot_sender.go +++ b/server/etcdserver/api/rafthttp/snapshot_sender.go @@ -21,14 +21,14 @@ import ( "net/http" "time" + "github.com/dustin/go-humanize" + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/pkg/v3/httputil" pioutil "go.etcd.io/etcd/pkg/v3/ioutil" "go.etcd.io/etcd/server/v3/etcdserver/api/snap" "go.etcd.io/raft/v3" - - "github.com/dustin/go-humanize" - "go.uber.org/zap" ) var ( diff --git a/server/etcdserver/api/rafthttp/stream.go b/server/etcdserver/api/rafthttp/stream.go index e364ea560e7..63ffe8fdcbe 100644 --- a/server/etcdserver/api/rafthttp/stream.go +++ b/server/etcdserver/api/rafthttp/stream.go @@ -24,16 +24,16 @@ import ( "sync" "time" + "github.com/coreos/go-semver/semver" + "go.uber.org/zap" + "golang.org/x/time/rate" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/pkg/v3/httputil" stats "go.etcd.io/etcd/server/v3/etcdserver/api/v2stats" "go.etcd.io/raft/v3/raftpb" - - "github.com/coreos/go-semver/semver" - "go.uber.org/zap" - "golang.org/x/time/rate" ) const ( diff --git a/server/etcdserver/api/rafthttp/stream_test.go b/server/etcdserver/api/rafthttp/stream_test.go index 0b0c6f2fd53..5ff4265e568 100644 --- a/server/etcdserver/api/rafthttp/stream_test.go +++ b/server/etcdserver/api/rafthttp/stream_test.go @@ -25,16 +25,15 @@ import ( "testing" "time" + "github.com/coreos/go-semver/semver" "go.uber.org/zap/zaptest" + "golang.org/x/time/rate" "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/testutil" "go.etcd.io/etcd/client/pkg/v3/types" stats "go.etcd.io/etcd/server/v3/etcdserver/api/v2stats" "go.etcd.io/raft/v3/raftpb" - - "github.com/coreos/go-semver/semver" - "golang.org/x/time/rate" ) // TestStreamWriterAttachOutgoingConn tests that outgoingConn can be attached diff --git a/server/etcdserver/api/rafthttp/transport.go b/server/etcdserver/api/rafthttp/transport.go index f4070044b06..b376d578b6c 100644 --- a/server/etcdserver/api/rafthttp/transport.go +++ b/server/etcdserver/api/rafthttp/transport.go @@ -20,16 +20,16 @@ import ( "sync" "time" + "github.com/xiang90/probing" + "go.uber.org/zap" + "golang.org/x/time/rate" + "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/etcdserver/api/snap" stats "go.etcd.io/etcd/server/v3/etcdserver/api/v2stats" "go.etcd.io/raft/v3" "go.etcd.io/raft/v3/raftpb" - - "github.com/xiang90/probing" - "go.uber.org/zap" - "golang.org/x/time/rate" ) type Raft interface { diff --git a/server/etcdserver/api/rafthttp/transport_test.go b/server/etcdserver/api/rafthttp/transport_test.go index 4748279369c..92adb01c490 100644 --- a/server/etcdserver/api/rafthttp/transport_test.go +++ b/server/etcdserver/api/rafthttp/transport_test.go @@ -20,14 +20,13 @@ import ( "testing" "time" + "github.com/xiang90/probing" "go.uber.org/zap/zaptest" "go.etcd.io/etcd/client/pkg/v3/testutil" "go.etcd.io/etcd/client/pkg/v3/types" stats "go.etcd.io/etcd/server/v3/etcdserver/api/v2stats" "go.etcd.io/raft/v3/raftpb" - - "github.com/xiang90/probing" ) // TestTransportSend tests that transport can send messages using correct diff --git a/server/etcdserver/api/rafthttp/util.go b/server/etcdserver/api/rafthttp/util.go index 854ce7b220a..5fe0728218b 100644 --- a/server/etcdserver/api/rafthttp/util.go +++ b/server/etcdserver/api/rafthttp/util.go @@ -23,12 +23,12 @@ import ( "strings" "time" + "github.com/coreos/go-semver/semver" + "go.uber.org/zap" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/pkg/v3/types" - - "github.com/coreos/go-semver/semver" - "go.uber.org/zap" ) var ( diff --git a/server/etcdserver/api/rafthttp/util_test.go b/server/etcdserver/api/rafthttp/util_test.go index 743333fbbe3..de94813f230 100644 --- a/server/etcdserver/api/rafthttp/util_test.go +++ b/server/etcdserver/api/rafthttp/util_test.go @@ -22,10 +22,10 @@ import ( "reflect" "testing" + "github.com/coreos/go-semver/semver" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/raft/v3/raftpb" - - "github.com/coreos/go-semver/semver" ) func TestEntry(t *testing.T) { diff --git a/server/etcdserver/api/snap/db.go b/server/etcdserver/api/snap/db.go index 1d42557bcc0..e8add5e3275 100644 --- a/server/etcdserver/api/snap/db.go +++ b/server/etcdserver/api/snap/db.go @@ -22,10 +22,10 @@ import ( "path/filepath" "time" - "go.etcd.io/etcd/client/pkg/v3/fileutil" - humanize "github.com/dustin/go-humanize" "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/fileutil" ) var ErrNoDBSnapshot = errors.New("snap: snapshot file doesn't exist") diff --git a/server/etcdserver/api/snap/snapshotter.go b/server/etcdserver/api/snap/snapshotter.go index 093ab6bc914..724c0f7f74b 100644 --- a/server/etcdserver/api/snap/snapshotter.go +++ b/server/etcdserver/api/snap/snapshotter.go @@ -25,6 +25,8 @@ import ( "strings" "time" + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/verify" pioutil "go.etcd.io/etcd/pkg/v3/ioutil" "go.etcd.io/etcd/pkg/v3/pbutil" @@ -32,8 +34,6 @@ import ( "go.etcd.io/etcd/server/v3/storage/wal/walpb" "go.etcd.io/raft/v3" "go.etcd.io/raft/v3/raftpb" - - "go.uber.org/zap" ) const snapSuffix = ".snap" diff --git a/server/etcdserver/api/v2discovery/discovery.go b/server/etcdserver/api/v2discovery/discovery.go index 9f1bc0adf50..5993d4458ec 100644 --- a/server/etcdserver/api/v2discovery/discovery.go +++ b/server/etcdserver/api/v2discovery/discovery.go @@ -29,12 +29,12 @@ import ( "strings" "time" + "github.com/jonboulle/clockwork" + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/client/v2" - - "github.com/jonboulle/clockwork" - "go.uber.org/zap" ) var ( diff --git a/server/etcdserver/api/v2discovery/discovery_test.go b/server/etcdserver/api/v2discovery/discovery_test.go index 7d42eb14ef0..91dbfd72aac 100644 --- a/server/etcdserver/api/v2discovery/discovery_test.go +++ b/server/etcdserver/api/v2discovery/discovery_test.go @@ -27,12 +27,11 @@ import ( "testing" "time" + "github.com/jonboulle/clockwork" "go.uber.org/zap/zaptest" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/client/v2" - - "github.com/jonboulle/clockwork" ) const ( diff --git a/server/etcdserver/api/v2store/node.go b/server/etcdserver/api/v2store/node.go index 9fe6263e2e8..1a446aa2023 100644 --- a/server/etcdserver/api/v2store/node.go +++ b/server/etcdserver/api/v2store/node.go @@ -19,9 +19,9 @@ import ( "sort" "time" - "go.etcd.io/etcd/server/v3/etcdserver/api/v2error" - "github.com/jonboulle/clockwork" + + "go.etcd.io/etcd/server/v3/etcdserver/api/v2error" ) // explanations of Compare function result diff --git a/server/etcdserver/api/v2store/store.go b/server/etcdserver/api/v2store/store.go index 32cb26ad964..689a07b55e9 100644 --- a/server/etcdserver/api/v2store/store.go +++ b/server/etcdserver/api/v2store/store.go @@ -23,10 +23,10 @@ import ( "sync" "time" + "github.com/jonboulle/clockwork" + "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/etcdserver/api/v2error" - - "github.com/jonboulle/clockwork" ) // The default version to set when the store is first initialized. diff --git a/server/etcdserver/api/v2store/store_ttl_test.go b/server/etcdserver/api/v2store/store_ttl_test.go index a0bac3e8c53..dcb7735f1f9 100644 --- a/server/etcdserver/api/v2store/store_ttl_test.go +++ b/server/etcdserver/api/v2store/store_ttl_test.go @@ -18,12 +18,11 @@ import ( "testing" "time" + "github.com/jonboulle/clockwork" "github.com/stretchr/testify/assert" "go.etcd.io/etcd/client/pkg/v3/testutil" "go.etcd.io/etcd/server/v3/etcdserver/api/v2error" - - "github.com/jonboulle/clockwork" ) // TestMinExpireTime ensures that any TTL <= minExpireTime becomes Permanent diff --git a/server/etcdserver/api/v3alarm/alarms.go b/server/etcdserver/api/v3alarm/alarms.go index 6dfcfd11797..e0480da081c 100644 --- a/server/etcdserver/api/v3alarm/alarms.go +++ b/server/etcdserver/api/v3alarm/alarms.go @@ -18,11 +18,11 @@ package v3alarm import ( "sync" + "go.uber.org/zap" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/storage/backend" - - "go.uber.org/zap" ) type BackendGetter interface { diff --git a/server/etcdserver/api/v3compactor/compactor.go b/server/etcdserver/api/v3compactor/compactor.go index e352670c12b..f916e71141b 100644 --- a/server/etcdserver/api/v3compactor/compactor.go +++ b/server/etcdserver/api/v3compactor/compactor.go @@ -19,10 +19,10 @@ import ( "fmt" "time" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "github.com/jonboulle/clockwork" "go.uber.org/zap" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" ) const ( diff --git a/server/etcdserver/api/v3compactor/periodic.go b/server/etcdserver/api/v3compactor/periodic.go index 853c1a9e7f3..98fbc381bb8 100644 --- a/server/etcdserver/api/v3compactor/periodic.go +++ b/server/etcdserver/api/v3compactor/periodic.go @@ -19,11 +19,11 @@ import ( "sync" "time" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "go.etcd.io/etcd/server/v3/storage/mvcc" - "github.com/jonboulle/clockwork" "go.uber.org/zap" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/server/v3/storage/mvcc" ) // Periodic compacts the log by purging revisions older than diff --git a/server/etcdserver/api/v3compactor/revision.go b/server/etcdserver/api/v3compactor/revision.go index 37492f2b4d5..326ac211d0b 100644 --- a/server/etcdserver/api/v3compactor/revision.go +++ b/server/etcdserver/api/v3compactor/revision.go @@ -19,11 +19,11 @@ import ( "sync" "time" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "go.etcd.io/etcd/server/v3/storage/mvcc" - "github.com/jonboulle/clockwork" "go.uber.org/zap" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/server/v3/storage/mvcc" ) // Revision compacts the log by purging revisions older than diff --git a/server/etcdserver/api/v3compactor/revision_test.go b/server/etcdserver/api/v3compactor/revision_test.go index e66cfc0859d..54e25f2b88c 100644 --- a/server/etcdserver/api/v3compactor/revision_test.go +++ b/server/etcdserver/api/v3compactor/revision_test.go @@ -19,12 +19,11 @@ import ( "testing" "time" + "github.com/jonboulle/clockwork" "go.uber.org/zap/zaptest" pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/testutil" - - "github.com/jonboulle/clockwork" ) func TestRevision(t *testing.T) { diff --git a/server/etcdserver/api/v3rpc/grpc.go b/server/etcdserver/api/v3rpc/grpc.go index 148914e0f9a..ed172cc78ae 100644 --- a/server/etcdserver/api/v3rpc/grpc.go +++ b/server/etcdserver/api/v3rpc/grpc.go @@ -18,16 +18,16 @@ import ( "crypto/tls" "math" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "go.etcd.io/etcd/client/v3/credentials" - "go.etcd.io/etcd/server/v3/etcdserver" - grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "google.golang.org/grpc" "google.golang.org/grpc/health" healthpb "google.golang.org/grpc/health/grpc_health_v1" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/client/v3/credentials" + "go.etcd.io/etcd/server/v3/etcdserver" ) const ( diff --git a/server/etcdserver/api/v3rpc/interceptor.go b/server/etcdserver/api/v3rpc/interceptor.go index c25b015ab47..776488ef919 100644 --- a/server/etcdserver/api/v3rpc/interceptor.go +++ b/server/etcdserver/api/v3rpc/interceptor.go @@ -20,18 +20,17 @@ import ( "time" "unicode/utf8" - "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - "go.etcd.io/etcd/client/pkg/v3/types" - "go.etcd.io/etcd/server/v3/etcdserver" - "go.etcd.io/etcd/server/v3/etcdserver/api" - "go.etcd.io/raft/v3" - "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" + "go.etcd.io/etcd/client/pkg/v3/types" + "go.etcd.io/etcd/server/v3/etcdserver" + "go.etcd.io/etcd/server/v3/etcdserver/api" + "go.etcd.io/raft/v3" ) const ( diff --git a/server/etcdserver/api/v3rpc/lease.go b/server/etcdserver/api/v3rpc/lease.go index e123dd2a37c..86f35113cd9 100644 --- a/server/etcdserver/api/v3rpc/lease.go +++ b/server/etcdserver/api/v3rpc/lease.go @@ -18,12 +18,12 @@ import ( "context" "io" + "go.uber.org/zap" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/server/v3/etcdserver" "go.etcd.io/etcd/server/v3/lease" - - "go.uber.org/zap" ) type LeaseServer struct { diff --git a/server/etcdserver/api/v3rpc/maintenance.go b/server/etcdserver/api/v3rpc/maintenance.go index 9920a9cbd6b..56309505760 100644 --- a/server/etcdserver/api/v3rpc/maintenance.go +++ b/server/etcdserver/api/v3rpc/maintenance.go @@ -21,6 +21,7 @@ import ( "time" "github.com/dustin/go-humanize" + "go.uber.org/zap" pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" @@ -33,8 +34,6 @@ import ( "go.etcd.io/etcd/server/v3/storage/mvcc" "go.etcd.io/etcd/server/v3/storage/schema" "go.etcd.io/raft/v3" - - "go.uber.org/zap" ) type KVGetter interface { diff --git a/server/etcdserver/api/v3rpc/util.go b/server/etcdserver/api/v3rpc/util.go index fc60c631d54..a31e6cbecca 100644 --- a/server/etcdserver/api/v3rpc/util.go +++ b/server/etcdserver/api/v3rpc/util.go @@ -18,6 +18,9 @@ import ( "context" "strings" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/server/v3/auth" @@ -26,9 +29,6 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver/version" "go.etcd.io/etcd/server/v3/lease" "go.etcd.io/etcd/server/v3/storage/mvcc" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) var toGRPCErrorMap = map[error]error{ diff --git a/server/etcdserver/api/v3rpc/util_test.go b/server/etcdserver/api/v3rpc/util_test.go index 3ffbbbb8cdb..ed686021d2b 100644 --- a/server/etcdserver/api/v3rpc/util_test.go +++ b/server/etcdserver/api/v3rpc/util_test.go @@ -19,11 +19,11 @@ import ( "errors" "testing" - "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - "go.etcd.io/etcd/server/v3/storage/mvcc" - "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" + "go.etcd.io/etcd/server/v3/storage/mvcc" ) func TestGRPCError(t *testing.T) { diff --git a/server/etcdserver/api/v3rpc/watch.go b/server/etcdserver/api/v3rpc/watch.go index a8d37efa098..3b82fe8d848 100644 --- a/server/etcdserver/api/v3rpc/watch.go +++ b/server/etcdserver/api/v3rpc/watch.go @@ -21,6 +21,8 @@ import ( "sync" "time" + "go.uber.org/zap" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/mvccpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" @@ -30,8 +32,6 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver" "go.etcd.io/etcd/server/v3/etcdserver/apply" "go.etcd.io/etcd/server/v3/storage/mvcc" - - "go.uber.org/zap" ) const minWatchProgressInterval = 100 * time.Millisecond diff --git a/server/etcdserver/apply/apply.go b/server/etcdserver/apply/apply.go index 7b6963d791c..1d465bf2bd9 100644 --- a/server/etcdserver/apply/apply.go +++ b/server/etcdserver/apply/apply.go @@ -17,6 +17,8 @@ package apply import ( "context" + "github.com/coreos/go-semver/semver" + "github.com/gogo/protobuf/proto" "go.uber.org/zap" pb "go.etcd.io/etcd/api/v3/etcdserverpb" @@ -35,9 +37,6 @@ import ( serverstorage "go.etcd.io/etcd/server/v3/storage" "go.etcd.io/etcd/server/v3/storage/backend" "go.etcd.io/etcd/server/v3/storage/mvcc" - - "github.com/coreos/go-semver/semver" - "github.com/gogo/protobuf/proto" ) const ( diff --git a/server/etcdserver/bootstrap_test.go b/server/etcdserver/bootstrap_test.go index d0a1389660d..66dc5243969 100644 --- a/server/etcdserver/bootstrap_test.go +++ b/server/etcdserver/bootstrap_test.go @@ -30,11 +30,6 @@ import ( "go.uber.org/zap/zaptest" bolt "go.etcd.io/bbolt" - "go.etcd.io/etcd/server/v3/storage/datadir" - "go.etcd.io/etcd/server/v3/storage/schema" - "go.etcd.io/etcd/server/v3/storage/wal" - "go.etcd.io/etcd/server/v3/storage/wal/walpb" - "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/types" @@ -43,6 +38,10 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver/api/snap" "go.etcd.io/etcd/server/v3/etcdserver/api/v2store" serverstorage "go.etcd.io/etcd/server/v3/storage" + "go.etcd.io/etcd/server/v3/storage/datadir" + "go.etcd.io/etcd/server/v3/storage/schema" + "go.etcd.io/etcd/server/v3/storage/wal" + "go.etcd.io/etcd/server/v3/storage/wal/walpb" "go.etcd.io/raft/v3/raftpb" ) diff --git a/server/etcdserver/cluster_util.go b/server/etcdserver/cluster_util.go index 220045c0590..85e66a0ad68 100644 --- a/server/etcdserver/cluster_util.go +++ b/server/etcdserver/cluster_util.go @@ -25,14 +25,14 @@ import ( "strings" "time" + "github.com/coreos/go-semver/semver" + "go.uber.org/zap" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/etcdserver/api/membership" "go.etcd.io/etcd/server/v3/etcdserver/api/v2store" "go.etcd.io/etcd/server/v3/etcdserver/errors" - - "github.com/coreos/go-semver/semver" - "go.uber.org/zap" ) // isMemberBootstrapped tries to check if the given member has been bootstrapped diff --git a/server/etcdserver/cluster_util_test.go b/server/etcdserver/cluster_util_test.go index d3f65364465..1ca9ec1345f 100644 --- a/server/etcdserver/cluster_util_test.go +++ b/server/etcdserver/cluster_util_test.go @@ -17,11 +17,11 @@ package etcdserver import ( "testing" - "github.com/coreos/go-semver/semver" - "go.uber.org/zap/zaptest" - "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/types" + + "github.com/coreos/go-semver/semver" + "go.uber.org/zap/zaptest" ) func TestIsCompatibleWithVers(t *testing.T) { diff --git a/server/etcdserver/corrupt.go b/server/etcdserver/corrupt.go index 9eec393b209..50eafdf6133 100644 --- a/server/etcdserver/corrupt.go +++ b/server/etcdserver/corrupt.go @@ -26,13 +26,13 @@ import ( "sync" "time" + "go.uber.org/zap" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp" "go.etcd.io/etcd/server/v3/storage/mvcc" - - "go.uber.org/zap" ) type CorruptionChecker interface { diff --git a/server/etcdserver/corrupt_test.go b/server/etcdserver/corrupt_test.go index 3fda1f40911..6a5da5d735a 100644 --- a/server/etcdserver/corrupt_test.go +++ b/server/etcdserver/corrupt_test.go @@ -27,17 +27,15 @@ import ( "testing" "time" - "go.uber.org/zap" - - "go.etcd.io/etcd/server/v3/lease" - betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" - "github.com/stretchr/testify/assert" + "go.uber.org/zap" "go.uber.org/zap/zaptest" pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/client/pkg/v3/types" + "go.etcd.io/etcd/server/v3/lease" + betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" "go.etcd.io/etcd/server/v3/storage/mvcc" ) diff --git a/server/etcdserver/metrics.go b/server/etcdserver/metrics.go index 954dfafca4e..7af0e7354d0 100644 --- a/server/etcdserver/metrics.go +++ b/server/etcdserver/metrics.go @@ -18,11 +18,11 @@ import ( goruntime "runtime" "time" - "go.etcd.io/etcd/api/v3/version" - "go.etcd.io/etcd/pkg/v3/runtime" - "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" + + "go.etcd.io/etcd/api/v3/version" + "go.etcd.io/etcd/pkg/v3/runtime" ) var ( diff --git a/server/etcdserver/raft.go b/server/etcdserver/raft.go index feb5b267464..2a315ea5865 100644 --- a/server/etcdserver/raft.go +++ b/server/etcdserver/raft.go @@ -23,13 +23,12 @@ import ( "go.uber.org/zap" - "go.etcd.io/raft/v3" - "go.etcd.io/raft/v3/raftpb" - "go.etcd.io/etcd/client/pkg/v3/logutil" "go.etcd.io/etcd/pkg/v3/contention" "go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp" serverstorage "go.etcd.io/etcd/server/v3/storage" + "go.etcd.io/raft/v3" + "go.etcd.io/raft/v3/raftpb" ) const ( diff --git a/server/etcdserver/raft_test.go b/server/etcdserver/raft_test.go index c8d9ff10e97..079aa13e2f7 100644 --- a/server/etcdserver/raft_test.go +++ b/server/etcdserver/raft_test.go @@ -24,14 +24,13 @@ import ( "go.uber.org/zap/zaptest" - "go.etcd.io/raft/v3" - "go.etcd.io/raft/v3/raftpb" - "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/pkg/v3/pbutil" "go.etcd.io/etcd/server/v3/etcdserver/api/membership" "go.etcd.io/etcd/server/v3/mock/mockstorage" serverstorage "go.etcd.io/etcd/server/v3/storage" + "go.etcd.io/raft/v3" + "go.etcd.io/raft/v3/raftpb" ) func TestGetIDs(t *testing.T) { diff --git a/server/etcdserver/server.go b/server/etcdserver/server.go index fdd99922736..0a8e2967e85 100644 --- a/server/etcdserver/server.go +++ b/server/etcdserver/server.go @@ -33,15 +33,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" - "go.etcd.io/etcd/pkg/v3/notify" - "go.etcd.io/etcd/pkg/v3/runtime" - "go.etcd.io/etcd/server/v3/config" - "go.etcd.io/etcd/server/v3/etcdserver/apply" - "go.etcd.io/etcd/server/v3/etcdserver/errors" - - "go.etcd.io/raft/v3" - "go.etcd.io/raft/v3/raftpb" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/membershippb" "go.etcd.io/etcd/api/v3/version" @@ -49,11 +40,14 @@ import ( "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/client/pkg/v3/verify" "go.etcd.io/etcd/pkg/v3/idutil" + "go.etcd.io/etcd/pkg/v3/notify" "go.etcd.io/etcd/pkg/v3/pbutil" + "go.etcd.io/etcd/pkg/v3/runtime" "go.etcd.io/etcd/pkg/v3/schedule" "go.etcd.io/etcd/pkg/v3/traceutil" "go.etcd.io/etcd/pkg/v3/wait" "go.etcd.io/etcd/server/v3/auth" + "go.etcd.io/etcd/server/v3/config" "go.etcd.io/etcd/server/v3/etcdserver/api" httptypes "go.etcd.io/etcd/server/v3/etcdserver/api/etcdhttp/types" "go.etcd.io/etcd/server/v3/etcdserver/api/membership" @@ -63,7 +57,9 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver/api/v2store" "go.etcd.io/etcd/server/v3/etcdserver/api/v3alarm" "go.etcd.io/etcd/server/v3/etcdserver/api/v3compactor" + "go.etcd.io/etcd/server/v3/etcdserver/apply" "go.etcd.io/etcd/server/v3/etcdserver/cindex" + "go.etcd.io/etcd/server/v3/etcdserver/errors" serverversion "go.etcd.io/etcd/server/v3/etcdserver/version" "go.etcd.io/etcd/server/v3/lease" "go.etcd.io/etcd/server/v3/lease/leasehttp" @@ -71,6 +67,8 @@ import ( "go.etcd.io/etcd/server/v3/storage/backend" "go.etcd.io/etcd/server/v3/storage/mvcc" "go.etcd.io/etcd/server/v3/storage/schema" + "go.etcd.io/raft/v3" + "go.etcd.io/raft/v3/raftpb" ) const ( diff --git a/server/etcdserver/server_test.go b/server/etcdserver/server_test.go index c61f00312a2..ea88987d383 100644 --- a/server/etcdserver/server_test.go +++ b/server/etcdserver/server_test.go @@ -32,9 +32,6 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zaptest" - "go.etcd.io/raft/v3" - "go.etcd.io/raft/v3/raftpb" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/membershippb" "go.etcd.io/etcd/client/pkg/v3/fileutil" @@ -61,6 +58,8 @@ import ( betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" "go.etcd.io/etcd/server/v3/storage/mvcc" "go.etcd.io/etcd/server/v3/storage/schema" + "go.etcd.io/raft/v3" + "go.etcd.io/raft/v3/raftpb" ) // TestDoLocalAction tests requests which do not need to go through raft to be applied, diff --git a/server/etcdserver/snapshot_merge.go b/server/etcdserver/snapshot_merge.go index 5afbc626c18..cc3c545bee2 100644 --- a/server/etcdserver/snapshot_merge.go +++ b/server/etcdserver/snapshot_merge.go @@ -17,12 +17,12 @@ package etcdserver import ( "io" + humanize "github.com/dustin/go-humanize" + "go.uber.org/zap" + "go.etcd.io/etcd/server/v3/etcdserver/api/snap" "go.etcd.io/etcd/server/v3/storage/backend" "go.etcd.io/raft/v3/raftpb" - - humanize "github.com/dustin/go-humanize" - "go.uber.org/zap" ) // createMergedSnapshotMessage creates a snapshot message that contains: raft status (term, conf), diff --git a/server/etcdserver/txn/txn_test.go b/server/etcdserver/txn/txn_test.go index 2e0ad45534b..54f465baf22 100644 --- a/server/etcdserver/txn/txn_test.go +++ b/server/etcdserver/txn/txn_test.go @@ -20,21 +20,19 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" - "go.etcd.io/etcd/pkg/v3/traceutil" - "go.etcd.io/etcd/api/v3/authpb" pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/pkg/v3/traceutil" "go.etcd.io/etcd/server/v3/auth" "go.etcd.io/etcd/server/v3/lease" "go.etcd.io/etcd/server/v3/storage/backend" betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" "go.etcd.io/etcd/server/v3/storage/mvcc" "go.etcd.io/etcd/server/v3/storage/schema" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type testCase struct { diff --git a/server/etcdserver/txn/util.go b/server/etcdserver/txn/util.go index a4a3168ffe5..f9987c6d5d1 100644 --- a/server/etcdserver/txn/util.go +++ b/server/etcdserver/txn/util.go @@ -21,10 +21,9 @@ import ( "time" "github.com/golang/protobuf/proto" + "go.uber.org/zap" pb "go.etcd.io/etcd/api/v3/etcdserverpb" - - "go.uber.org/zap" ) func WarnOfExpensiveRequest(lg *zap.Logger, warningApplyDuration time.Duration, now time.Time, reqStringer fmt.Stringer, respMsg proto.Message, err error) { diff --git a/server/etcdserver/txn/util_test.go b/server/etcdserver/txn/util_test.go index 096b317d842..016f8211cd8 100644 --- a/server/etcdserver/txn/util_test.go +++ b/server/etcdserver/txn/util_test.go @@ -18,10 +18,10 @@ import ( "testing" "time" + "go.uber.org/zap/zaptest" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/mvccpb" - - "go.uber.org/zap/zaptest" ) // TestWarnOfExpensiveReadOnlyTxnRequest verifies WarnOfExpensiveReadOnlyTxnRequest diff --git a/server/etcdserver/v3_server.go b/server/etcdserver/v3_server.go index 739eb2418ec..07d1f546c9f 100644 --- a/server/etcdserver/v3_server.go +++ b/server/etcdserver/v3_server.go @@ -22,6 +22,10 @@ import ( "strconv" "time" + "github.com/gogo/protobuf/proto" + "go.uber.org/zap" + "golang.org/x/crypto/bcrypt" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/pkg/v3/traceutil" @@ -34,10 +38,6 @@ import ( "go.etcd.io/etcd/server/v3/lease/leasehttp" "go.etcd.io/etcd/server/v3/storage/mvcc" "go.etcd.io/raft/v3" - - "github.com/gogo/protobuf/proto" - "go.uber.org/zap" - "golang.org/x/crypto/bcrypt" ) const ( diff --git a/server/etcdserver/zap_raft.go b/server/etcdserver/zap_raft.go index 8d2063d9bee..7672bdfbc4c 100644 --- a/server/etcdserver/zap_raft.go +++ b/server/etcdserver/zap_raft.go @@ -17,10 +17,10 @@ package etcdserver import ( "errors" - "go.etcd.io/raft/v3" - "go.uber.org/zap" "go.uber.org/zap/zapcore" + + "go.etcd.io/raft/v3" ) // NewRaftLogger builds "raft.Logger" from "*zap.Config". diff --git a/server/proxy/grpcproxy/adapter/auth_client_adapter.go b/server/proxy/grpcproxy/adapter/auth_client_adapter.go index 140212b9620..0baa10c5f16 100644 --- a/server/proxy/grpcproxy/adapter/auth_client_adapter.go +++ b/server/proxy/grpcproxy/adapter/auth_client_adapter.go @@ -17,9 +17,9 @@ package adapter import ( "context" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - grpc "google.golang.org/grpc" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" ) type as2ac struct{ as pb.AuthServer } diff --git a/server/proxy/grpcproxy/adapter/cluster_client_adapter.go b/server/proxy/grpcproxy/adapter/cluster_client_adapter.go index c1fff054de4..4c9fbbb0826 100644 --- a/server/proxy/grpcproxy/adapter/cluster_client_adapter.go +++ b/server/proxy/grpcproxy/adapter/cluster_client_adapter.go @@ -17,9 +17,9 @@ package adapter import ( "context" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "google.golang.org/grpc" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" ) type cls2clc struct{ cls pb.ClusterServer } diff --git a/server/proxy/grpcproxy/adapter/election_client_adapter.go b/server/proxy/grpcproxy/adapter/election_client_adapter.go index e4cdd299251..b1266318f9a 100644 --- a/server/proxy/grpcproxy/adapter/election_client_adapter.go +++ b/server/proxy/grpcproxy/adapter/election_client_adapter.go @@ -17,9 +17,9 @@ package adapter import ( "context" - "go.etcd.io/etcd/server/v3/etcdserver/api/v3election/v3electionpb" - "google.golang.org/grpc" + + "go.etcd.io/etcd/server/v3/etcdserver/api/v3election/v3electionpb" ) type es2ec struct{ es v3electionpb.ElectionServer } diff --git a/server/proxy/grpcproxy/adapter/kv_client_adapter.go b/server/proxy/grpcproxy/adapter/kv_client_adapter.go index ddb6ada4732..69e3a113c4f 100644 --- a/server/proxy/grpcproxy/adapter/kv_client_adapter.go +++ b/server/proxy/grpcproxy/adapter/kv_client_adapter.go @@ -17,9 +17,9 @@ package adapter import ( "context" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - grpc "google.golang.org/grpc" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" ) type kvs2kvc struct{ kvs pb.KVServer } diff --git a/server/proxy/grpcproxy/adapter/lease_client_adapter.go b/server/proxy/grpcproxy/adapter/lease_client_adapter.go index d89c3024ea6..4369c3052f5 100644 --- a/server/proxy/grpcproxy/adapter/lease_client_adapter.go +++ b/server/proxy/grpcproxy/adapter/lease_client_adapter.go @@ -17,9 +17,9 @@ package adapter import ( "context" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "google.golang.org/grpc" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" ) type ls2lc struct { diff --git a/server/proxy/grpcproxy/adapter/lock_client_adapter.go b/server/proxy/grpcproxy/adapter/lock_client_adapter.go index a3ceaf26dae..de5ba049e19 100644 --- a/server/proxy/grpcproxy/adapter/lock_client_adapter.go +++ b/server/proxy/grpcproxy/adapter/lock_client_adapter.go @@ -17,9 +17,9 @@ package adapter import ( "context" - "go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb" - "google.golang.org/grpc" + + "go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb" ) type ls2lsc struct{ ls v3lockpb.LockServer } diff --git a/server/proxy/grpcproxy/adapter/maintenance_client_adapter.go b/server/proxy/grpcproxy/adapter/maintenance_client_adapter.go index 17ccafe7df5..d3bb805a1f6 100644 --- a/server/proxy/grpcproxy/adapter/maintenance_client_adapter.go +++ b/server/proxy/grpcproxy/adapter/maintenance_client_adapter.go @@ -17,9 +17,9 @@ package adapter import ( "context" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "google.golang.org/grpc" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" ) type mts2mtc struct{ mts pb.MaintenanceServer } diff --git a/server/proxy/grpcproxy/cluster.go b/server/proxy/grpcproxy/cluster.go index d687fdff7b1..a528e161ef3 100644 --- a/server/proxy/grpcproxy/cluster.go +++ b/server/proxy/grpcproxy/cluster.go @@ -21,13 +21,12 @@ import ( "os" "sync" + "go.uber.org/zap" "golang.org/x/time/rate" pb "go.etcd.io/etcd/api/v3/etcdserverpb" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/naming/endpoints" - - "go.uber.org/zap" ) // allow maximum 1 retry per second diff --git a/server/proxy/grpcproxy/leader.go b/server/proxy/grpcproxy/leader.go index 158e3ee8814..18e0a838232 100644 --- a/server/proxy/grpcproxy/leader.go +++ b/server/proxy/grpcproxy/leader.go @@ -19,9 +19,9 @@ import ( "math" "sync" - clientv3 "go.etcd.io/etcd/client/v3" - "golang.org/x/time/rate" + + clientv3 "go.etcd.io/etcd/client/v3" ) const ( diff --git a/server/proxy/grpcproxy/lease.go b/server/proxy/grpcproxy/lease.go index d206dcab49b..fdc936ca929 100644 --- a/server/proxy/grpcproxy/lease.go +++ b/server/proxy/grpcproxy/lease.go @@ -21,14 +21,14 @@ import ( "sync/atomic" "time" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - clientv3 "go.etcd.io/etcd/client/v3" - "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" + clientv3 "go.etcd.io/etcd/client/v3" ) type leaseProxy struct { diff --git a/server/proxy/grpcproxy/register.go b/server/proxy/grpcproxy/register.go index 98ba6c80bc2..bb860405a1d 100644 --- a/server/proxy/grpcproxy/register.go +++ b/server/proxy/grpcproxy/register.go @@ -18,12 +18,12 @@ import ( "encoding/json" "os" + "go.uber.org/zap" + "golang.org/x/time/rate" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" "go.etcd.io/etcd/client/v3/naming/endpoints" - - "go.uber.org/zap" - "golang.org/x/time/rate" ) // allow maximum 1 retry per second diff --git a/server/proxy/grpcproxy/util.go b/server/proxy/grpcproxy/util.go index 446eefd6134..7e3d3193b31 100644 --- a/server/proxy/grpcproxy/util.go +++ b/server/proxy/grpcproxy/util.go @@ -17,10 +17,10 @@ package grpcproxy import ( "context" - "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - "google.golang.org/grpc" "google.golang.org/grpc/metadata" + + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" ) func getAuthTokenFromClient(ctx context.Context) string { diff --git a/server/proxy/grpcproxy/watch_broadcast.go b/server/proxy/grpcproxy/watch_broadcast.go index 1d9a43df143..1f07f6ac5e2 100644 --- a/server/proxy/grpcproxy/watch_broadcast.go +++ b/server/proxy/grpcproxy/watch_broadcast.go @@ -19,10 +19,10 @@ import ( "sync" "time" + "go.uber.org/zap" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" clientv3 "go.etcd.io/etcd/client/v3" - - "go.uber.org/zap" ) // watchBroadcast broadcasts a server watcher to many client watchers. diff --git a/server/storage/backend.go b/server/storage/backend.go index 8edfbc12e50..9f518f11c00 100644 --- a/server/storage/backend.go +++ b/server/storage/backend.go @@ -19,13 +19,13 @@ import ( "os" "time" + "go.uber.org/zap" + "go.etcd.io/etcd/server/v3/config" "go.etcd.io/etcd/server/v3/etcdserver/api/snap" "go.etcd.io/etcd/server/v3/storage/backend" "go.etcd.io/etcd/server/v3/storage/schema" "go.etcd.io/raft/v3/raftpb" - - "go.uber.org/zap" ) func newBackend(cfg config.ServerConfig, hooks backend.Hooks) backend.Backend { diff --git a/server/storage/backend/backend_bench_test.go b/server/storage/backend/backend_bench_test.go index 204d7de6157..e6b1bdef876 100644 --- a/server/storage/backend/backend_bench_test.go +++ b/server/storage/backend/backend_bench_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/assert" + betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" "go.etcd.io/etcd/server/v3/storage/schema" ) diff --git a/server/storage/backend/backend_test.go b/server/storage/backend/backend_test.go index 0b0b6b8ec9b..57f31a7b4d0 100644 --- a/server/storage/backend/backend_test.go +++ b/server/storage/backend/backend_test.go @@ -22,11 +22,12 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.uber.org/zap/zaptest" + bolt "go.etcd.io/bbolt" "go.etcd.io/etcd/server/v3/storage/backend" betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" "go.etcd.io/etcd/server/v3/storage/schema" - "go.uber.org/zap/zaptest" ) func TestBackendClose(t *testing.T) { diff --git a/server/storage/backend/hooks_test.go b/server/storage/backend/hooks_test.go index afc4e883351..22f8aee3ddd 100644 --- a/server/storage/backend/hooks_test.go +++ b/server/storage/backend/hooks_test.go @@ -20,10 +20,11 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.uber.org/zap/zaptest" + "go.etcd.io/etcd/server/v3/storage/backend" betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" "go.etcd.io/etcd/server/v3/storage/schema" - "go.uber.org/zap/zaptest" ) var ( diff --git a/server/storage/datadir/datadir_test.go b/server/storage/datadir/datadir_test.go index 623614351bd..03e14758799 100644 --- a/server/storage/datadir/datadir_test.go +++ b/server/storage/datadir/datadir_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.etcd.io/etcd/server/v3/storage/datadir" ) diff --git a/server/storage/mvcc/kv_test.go b/server/storage/mvcc/kv_test.go index ef5461035f4..9b8243c334c 100644 --- a/server/storage/mvcc/kv_test.go +++ b/server/storage/mvcc/kv_test.go @@ -22,6 +22,8 @@ import ( "testing" "time" + "github.com/prometheus/client_golang/prometheus" + dto "github.com/prometheus/client_model/go" "go.uber.org/zap/zaptest" "go.etcd.io/etcd/api/v3/mvccpb" @@ -30,9 +32,6 @@ import ( "go.etcd.io/etcd/server/v3/lease" "go.etcd.io/etcd/server/v3/storage/backend" betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" - - "github.com/prometheus/client_golang/prometheus" - dto "github.com/prometheus/client_model/go" ) // Functional tests for features implemented in v3 store. It treats v3 store diff --git a/server/storage/mvcc/kvstore.go b/server/storage/mvcc/kvstore.go index d4c44e42182..26edb12bf97 100644 --- a/server/storage/mvcc/kvstore.go +++ b/server/storage/mvcc/kvstore.go @@ -22,14 +22,14 @@ import ( "sync" "time" + "go.uber.org/zap" + "go.etcd.io/etcd/api/v3/mvccpb" "go.etcd.io/etcd/pkg/v3/schedule" "go.etcd.io/etcd/pkg/v3/traceutil" "go.etcd.io/etcd/server/v3/lease" "go.etcd.io/etcd/server/v3/storage/backend" "go.etcd.io/etcd/server/v3/storage/schema" - - "go.uber.org/zap" ) var ( diff --git a/server/storage/mvcc/kvstore_test.go b/server/storage/mvcc/kvstore_test.go index b8a3661ad7c..7670d973baf 100644 --- a/server/storage/mvcc/kvstore_test.go +++ b/server/storage/mvcc/kvstore_test.go @@ -29,6 +29,7 @@ import ( "testing" "time" + "go.uber.org/zap" "go.uber.org/zap/zaptest" "go.etcd.io/etcd/api/v3/mvccpb" @@ -39,8 +40,6 @@ import ( "go.etcd.io/etcd/server/v3/storage/backend" betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" "go.etcd.io/etcd/server/v3/storage/schema" - - "go.uber.org/zap" ) func TestStoreRev(t *testing.T) { diff --git a/server/storage/mvcc/watchable_store.go b/server/storage/mvcc/watchable_store.go index 4e7b5a71407..ee4ae7295ed 100644 --- a/server/storage/mvcc/watchable_store.go +++ b/server/storage/mvcc/watchable_store.go @@ -18,14 +18,14 @@ import ( "sync" "time" + "go.uber.org/zap" + "go.etcd.io/etcd/api/v3/mvccpb" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/pkg/v3/traceutil" "go.etcd.io/etcd/server/v3/lease" "go.etcd.io/etcd/server/v3/storage/backend" "go.etcd.io/etcd/server/v3/storage/schema" - - "go.uber.org/zap" ) // non-const so modifiable by tests diff --git a/server/storage/quota.go b/server/storage/quota.go index 50f19389604..f9ff72d7e82 100644 --- a/server/storage/quota.go +++ b/server/storage/quota.go @@ -17,11 +17,11 @@ package storage import ( "sync" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" - "go.etcd.io/etcd/server/v3/storage/backend" - humanize "github.com/dustin/go-humanize" "go.uber.org/zap" + + pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/server/v3/storage/backend" ) const ( diff --git a/server/storage/schema/auth_users.go b/server/storage/schema/auth_users.go index 6ea9dd98a41..c21fa7c16d8 100644 --- a/server/storage/schema/auth_users.go +++ b/server/storage/schema/auth_users.go @@ -17,9 +17,8 @@ package schema import ( "go.uber.org/zap" - "go.etcd.io/etcd/server/v3/storage/backend" - "go.etcd.io/etcd/api/v3/authpb" + "go.etcd.io/etcd/server/v3/storage/backend" ) func (abe *authBackend) GetUser(username string) *authpb.User { diff --git a/server/storage/schema/membership.go b/server/storage/schema/membership.go index 137d2785071..44e2af1cd7f 100644 --- a/server/storage/schema/membership.go +++ b/server/storage/schema/membership.go @@ -18,13 +18,13 @@ import ( "encoding/json" "fmt" + "github.com/coreos/go-semver/semver" + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/etcdserver/api/membership" "go.etcd.io/etcd/server/v3/etcdserver/version" "go.etcd.io/etcd/server/v3/storage/backend" - - "github.com/coreos/go-semver/semver" - "go.uber.org/zap" ) const ( diff --git a/server/storage/schema/schema.go b/server/storage/schema/schema.go index 890810511ae..eb4fd3a2a5b 100644 --- a/server/storage/schema/schema.go +++ b/server/storage/schema/schema.go @@ -21,7 +21,6 @@ import ( "go.uber.org/zap" "go.etcd.io/etcd/api/v3/version" - "go.etcd.io/etcd/server/v3/storage/backend" ) diff --git a/server/storage/schema/version_test.go b/server/storage/schema/version_test.go index 2a78d88a6b2..576f063df77 100644 --- a/server/storage/schema/version_test.go +++ b/server/storage/schema/version_test.go @@ -23,7 +23,6 @@ import ( "go.uber.org/zap/zaptest" "go.etcd.io/bbolt" - "go.etcd.io/etcd/server/v3/storage/backend" betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" ) diff --git a/server/storage/wal/file_pipeline.go b/server/storage/wal/file_pipeline.go index 9d3a78104f2..bdfa31b5e2a 100644 --- a/server/storage/wal/file_pipeline.go +++ b/server/storage/wal/file_pipeline.go @@ -19,9 +19,9 @@ import ( "os" "path/filepath" - "go.etcd.io/etcd/client/pkg/v3/fileutil" - "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/fileutil" ) // filePipeline pipelines allocating disk space diff --git a/server/storage/wal/util.go b/server/storage/wal/util.go index 7da3d35177d..f9e6b5fd160 100644 --- a/server/storage/wal/util.go +++ b/server/storage/wal/util.go @@ -19,9 +19,9 @@ import ( "fmt" "strings" - "go.etcd.io/etcd/client/pkg/v3/fileutil" - "go.uber.org/zap" + + "go.etcd.io/etcd/client/pkg/v3/fileutil" ) var errBadWALName = errors.New("bad wal name") diff --git a/server/storage/wal/version.go b/server/storage/wal/version.go index 8df0a46baab..010a7cd695f 100644 --- a/server/storage/wal/version.go +++ b/server/storage/wal/version.go @@ -23,9 +23,8 @@ import ( "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/descriptorpb" - "go.etcd.io/etcd/api/v3/version" - "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/pkg/v3/pbutil" "go.etcd.io/raft/v3/raftpb" ) diff --git a/server/storage/wal/wal.go b/server/storage/wal/wal.go index 4eeafbd9098..ee9727b0d7d 100644 --- a/server/storage/wal/wal.go +++ b/server/storage/wal/wal.go @@ -26,13 +26,13 @@ import ( "sync" "time" + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/pkg/v3/pbutil" "go.etcd.io/etcd/server/v3/storage/wal/walpb" "go.etcd.io/raft/v3" "go.etcd.io/raft/v3/raftpb" - - "go.uber.org/zap" ) const ( diff --git a/server/verify/verify.go b/server/verify/verify.go index 024b0b4eb9e..6aaf1422aee 100644 --- a/server/verify/verify.go +++ b/server/verify/verify.go @@ -19,8 +19,6 @@ import ( "go.uber.org/zap" - "go.etcd.io/raft/v3/raftpb" - "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/client/pkg/v3/verify" "go.etcd.io/etcd/server/v3/storage/backend" @@ -28,6 +26,7 @@ import ( "go.etcd.io/etcd/server/v3/storage/schema" wal2 "go.etcd.io/etcd/server/v3/storage/wal" "go.etcd.io/etcd/server/v3/storage/wal/walpb" + "go.etcd.io/raft/v3/raftpb" ) const ENV_VERIFY_VALUE_STORAGE_WAL verify.VerificationType = "storage_wal" diff --git a/tests/common/auth_test.go b/tests/common/auth_test.go index cd543905198..ad7814220f8 100644 --- a/tests/common/auth_test.go +++ b/tests/common/auth_test.go @@ -21,11 +21,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/testutils" - - "github.com/stretchr/testify/require" ) var tokenTTL = time.Second diff --git a/tests/e2e/etcd_config_test.go b/tests/e2e/etcd_config_test.go index 2afe228006b..23240611171 100644 --- a/tests/e2e/etcd_config_test.go +++ b/tests/e2e/etcd_config_test.go @@ -24,7 +24,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/sync/errgroup" "go.etcd.io/etcd/pkg/v3/expect" diff --git a/tests/e2e/graceful_shutdown_test.go b/tests/e2e/graceful_shutdown_test.go index dd10febfe5e..cc69955335b 100644 --- a/tests/e2e/graceful_shutdown_test.go +++ b/tests/e2e/graceful_shutdown_test.go @@ -22,11 +22,10 @@ import ( "github.com/stretchr/testify/require" - "go.etcd.io/raft/v3" - "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/e2e" "go.etcd.io/etcd/tests/v3/framework/interfaces" + "go.etcd.io/raft/v3" ) func TestGracefulShutdown(t *testing.T) { diff --git a/tests/e2e/v3_curl_lock_test.go b/tests/e2e/v3_curl_lock_test.go index e817b691eb4..9bf7b1e1abc 100644 --- a/tests/e2e/v3_curl_lock_test.go +++ b/tests/e2e/v3_curl_lock_test.go @@ -17,7 +17,6 @@ package e2e import ( "encoding/json" "fmt" - "testing" "github.com/stretchr/testify/require" diff --git a/tests/framework/integration/cluster.go b/tests/framework/integration/cluster.go index f569f92c569..7edd1942201 100644 --- a/tests/framework/integration/cluster.go +++ b/tests/framework/integration/cluster.go @@ -34,10 +34,15 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/soheilhy/cmux" + "go.uber.org/zap" "go.uber.org/zap/zapcore" "go.uber.org/zap/zaptest" - - "go.etcd.io/raft/v3" + "golang.org/x/crypto/bcrypt" + "google.golang.org/grpc" + "google.golang.org/grpc/keepalive" pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/testutil" @@ -61,14 +66,7 @@ import ( "go.etcd.io/etcd/server/v3/verify" framecfg "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/testutils" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/soheilhy/cmux" - "go.uber.org/zap" - "golang.org/x/crypto/bcrypt" - "google.golang.org/grpc" - "google.golang.org/grpc/keepalive" + "go.etcd.io/raft/v3" ) const ( diff --git a/tests/framework/integration/integration.go b/tests/framework/integration/integration.go index 8d5f786e717..6e182e7f127 100644 --- a/tests/framework/integration/integration.go +++ b/tests/framework/integration/integration.go @@ -20,15 +20,13 @@ import ( "strings" "testing" - healthpb "google.golang.org/grpc/health/grpc_health_v1" - "go.uber.org/zap" + healthpb "google.golang.org/grpc/health/grpc_health_v1" "go.etcd.io/etcd/client/pkg/v3/testutil" "go.etcd.io/etcd/client/pkg/v3/transport" clientv3 "go.etcd.io/etcd/client/v3" etcdctlcmd "go.etcd.io/etcd/etcdctl/v3/ctlv3/command" - "go.etcd.io/etcd/tests/v3/framework/config" intf "go.etcd.io/etcd/tests/v3/framework/interfaces" ) diff --git a/tests/framework/integration/testing.go b/tests/framework/integration/testing.go index b0580dcd670..97450e7c9be 100644 --- a/tests/framework/integration/testing.go +++ b/tests/framework/integration/testing.go @@ -24,12 +24,11 @@ import ( "go.uber.org/zap/zapgrpc" "go.uber.org/zap/zaptest" - gofail "go.etcd.io/gofail/runtime" - "go.etcd.io/etcd/client/pkg/v3/testutil" "go.etcd.io/etcd/client/pkg/v3/verify" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/server/v3/embed" + gofail "go.etcd.io/gofail/runtime" ) var grpc_logger grpc_logsettable.SettableLoggerV2 diff --git a/tests/framework/testrunner.go b/tests/framework/testrunner.go index d5da5e79cbf..3467314b36c 100644 --- a/tests/framework/testrunner.go +++ b/tests/framework/testrunner.go @@ -15,10 +15,9 @@ package framework import ( - intf "go.etcd.io/etcd/tests/v3/framework/interfaces" - "go.etcd.io/etcd/tests/v3/framework/e2e" "go.etcd.io/etcd/tests/v3/framework/integration" + intf "go.etcd.io/etcd/tests/v3/framework/interfaces" "go.etcd.io/etcd/tests/v3/framework/unit" ) diff --git a/tests/integration/clientv3/concurrency/session_test.go b/tests/integration/clientv3/concurrency/session_test.go index b1799117975..a1f8d92859e 100644 --- a/tests/integration/clientv3/concurrency/session_test.go +++ b/tests/integration/clientv3/concurrency/session_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/assert" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" integration2 "go.etcd.io/etcd/tests/v3/framework/integration" diff --git a/tests/integration/clientv3/connectivity/black_hole_test.go b/tests/integration/clientv3/connectivity/black_hole_test.go index 0a9ad3318aa..23593ffc8e5 100644 --- a/tests/integration/clientv3/connectivity/black_hole_test.go +++ b/tests/integration/clientv3/connectivity/black_hole_test.go @@ -21,11 +21,12 @@ import ( "testing" "time" + "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" - "google.golang.org/grpc" ) // TestBalancerUnderBlackholeKeepAliveWatch tests when watch discovers it cannot talk to diff --git a/tests/integration/clientv3/connectivity/dial_test.go b/tests/integration/clientv3/connectivity/dial_test.go index 4f9f7784f45..73864d6d30c 100644 --- a/tests/integration/clientv3/connectivity/dial_test.go +++ b/tests/integration/clientv3/connectivity/dial_test.go @@ -21,13 +21,14 @@ import ( "testing" "time" + "google.golang.org/grpc" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/transport" clientv3 "go.etcd.io/etcd/client/v3" integration2 "go.etcd.io/etcd/tests/v3/framework/integration" "go.etcd.io/etcd/tests/v3/framework/testutils" clientv3test "go.etcd.io/etcd/tests/v3/integration/clientv3" - "google.golang.org/grpc" ) var ( diff --git a/tests/integration/clientv3/connectivity/network_partition_test.go b/tests/integration/clientv3/connectivity/network_partition_test.go index 5b9cc602e15..80a188af7d3 100644 --- a/tests/integration/clientv3/connectivity/network_partition_test.go +++ b/tests/integration/clientv3/connectivity/network_partition_test.go @@ -22,12 +22,13 @@ import ( "testing" "time" + "google.golang.org/grpc" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "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" - "google.golang.org/grpc" ) var errExpected = errors.New("expected error") diff --git a/tests/integration/clientv3/lease/leasing_test.go b/tests/integration/clientv3/lease/leasing_test.go index 342cf2e9103..2164e8f5b18 100644 --- a/tests/integration/clientv3/lease/leasing_test.go +++ b/tests/integration/clientv3/lease/leasing_test.go @@ -24,6 +24,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.etcd.io/etcd/client/pkg/v3/testutil" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" diff --git a/tests/integration/clientv3/maintenance_test.go b/tests/integration/clientv3/maintenance_test.go index d338a1bdca6..e5c9812f8b9 100644 --- a/tests/integration/clientv3/maintenance_test.go +++ b/tests/integration/clientv3/maintenance_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + "google.golang.org/grpc" + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/api/v3/version" clientv3 "go.etcd.io/etcd/client/v3" @@ -34,10 +38,6 @@ import ( "go.etcd.io/etcd/server/v3/storage/mvcc" "go.etcd.io/etcd/server/v3/storage/mvcc/testutil" integration2 "go.etcd.io/etcd/tests/v3/framework/integration" - - "github.com/stretchr/testify/require" - "go.uber.org/zap/zaptest" - "google.golang.org/grpc" ) func TestMaintenanceHashKV(t *testing.T) { diff --git a/tests/integration/clientv3/snapshot/v3_snapshot_test.go b/tests/integration/clientv3/snapshot/v3_snapshot_test.go index 5f4fb2adc8d..9e424514145 100644 --- a/tests/integration/clientv3/snapshot/v3_snapshot_test.go +++ b/tests/integration/clientv3/snapshot/v3_snapshot_test.go @@ -24,13 +24,14 @@ import ( "testing" "time" + "go.uber.org/zap/zaptest" + "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/client/pkg/v3/testutil" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/snapshot" "go.etcd.io/etcd/server/v3/embed" integration2 "go.etcd.io/etcd/tests/v3/framework/integration" - "go.uber.org/zap/zaptest" ) // TestSaveSnapshotFilePermissions ensures that the snapshot is saved with diff --git a/tests/integration/embed/embed_test.go b/tests/integration/embed/embed_test.go index 4d6bb7f9f16..7cdb42934b8 100644 --- a/tests/integration/embed/embed_test.go +++ b/tests/integration/embed/embed_test.go @@ -30,6 +30,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.etcd.io/etcd/client/pkg/v3/testutil" "go.etcd.io/etcd/client/pkg/v3/transport" clientv3 "go.etcd.io/etcd/client/v3" diff --git a/tests/integration/revision_test.go b/tests/integration/revision_test.go index 6fb81b9ca5f..c1a27028cce 100644 --- a/tests/integration/revision_test.go +++ b/tests/integration/revision_test.go @@ -23,8 +23,9 @@ import ( "testing" "time" - "go.etcd.io/etcd/tests/v3/framework/integration" "google.golang.org/grpc/status" + + "go.etcd.io/etcd/tests/v3/framework/integration" ) func TestRevisionMonotonicWithLeaderPartitions(t *testing.T) { diff --git a/tests/integration/snapshot/v3_snapshot_test.go b/tests/integration/snapshot/v3_snapshot_test.go index 32c68336f94..f221ee78cc6 100644 --- a/tests/integration/snapshot/v3_snapshot_test.go +++ b/tests/integration/snapshot/v3_snapshot_test.go @@ -24,14 +24,15 @@ import ( "testing" "time" + "go.uber.org/zap/zapcore" + "go.uber.org/zap/zaptest" + "go.etcd.io/etcd/client/pkg/v3/testutil" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/etcdutl/v3/snapshot" "go.etcd.io/etcd/server/v3/embed" integration2 "go.etcd.io/etcd/tests/v3/framework/integration" "go.etcd.io/etcd/tests/v3/framework/testutils" - "go.uber.org/zap/zapcore" - "go.uber.org/zap/zaptest" ) // TestSnapshotV3RestoreSingle tests single node cluster restoring diff --git a/tests/integration/v2store/store_tag_test.go b/tests/integration/v2store/store_tag_test.go index ec6b02a05f5..3bcda9f48c3 100644 --- a/tests/integration/v2store/store_tag_test.go +++ b/tests/integration/v2store/store_tag_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.etcd.io/etcd/client/pkg/v3/testutil" "go.etcd.io/etcd/server/v3/etcdserver/api/v2store" integration2 "go.etcd.io/etcd/tests/v3/framework/integration" diff --git a/tests/integration/v2store/store_test.go b/tests/integration/v2store/store_test.go index 8ae8e7f7ce2..3a3a1f4979c 100644 --- a/tests/integration/v2store/store_test.go +++ b/tests/integration/v2store/store_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.etcd.io/etcd/client/pkg/v3/testutil" "go.etcd.io/etcd/server/v3/etcdserver/api/v2error" "go.etcd.io/etcd/server/v3/etcdserver/api/v2store" diff --git a/tests/integration/v3_grpc_test.go b/tests/integration/v3_grpc_test.go index a6dfb940421..566597753ee 100644 --- a/tests/integration/v3_grpc_test.go +++ b/tests/integration/v3_grpc_test.go @@ -25,17 +25,17 @@ import ( "testing" "time" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/client/pkg/v3/transport" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/integration" - - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" ) // TestV3PutOverwrite puts a key with the v3 api to a random Cluster member, diff --git a/tests/integration/v3_lease_test.go b/tests/integration/v3_lease_test.go index 7101cf905af..ab22652e56e 100644 --- a/tests/integration/v3_lease_test.go +++ b/tests/integration/v3_lease_test.go @@ -22,16 +22,16 @@ import ( "testing" "time" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/mvccpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/client/pkg/v3/testutil" framecfg "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/integration" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" ) // TestV3LeasePromote ensures the newly elected leader can promote itself diff --git a/tests/robustness/linearizability_test.go b/tests/robustness/linearizability_test.go index 30bf8d8abb7..e905ada83d4 100644 --- a/tests/robustness/linearizability_test.go +++ b/tests/robustness/linearizability_test.go @@ -20,17 +20,15 @@ import ( "testing" "time" - "go.etcd.io/etcd/tests/v3/robustness/model" - "go.uber.org/zap" "go.uber.org/zap/zaptest" "golang.org/x/sync/errgroup" - "go.etcd.io/etcd/tests/v3/robustness/report" - "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/tests/v3/framework/e2e" "go.etcd.io/etcd/tests/v3/robustness/identity" + "go.etcd.io/etcd/tests/v3/robustness/model" + "go.etcd.io/etcd/tests/v3/robustness/report" "go.etcd.io/etcd/tests/v3/robustness/traffic" "go.etcd.io/etcd/tests/v3/robustness/validate" ) diff --git a/tests/robustness/traffic/client.go b/tests/robustness/traffic/client.go index 71428140a94..2d24c76ab35 100644 --- a/tests/robustness/traffic/client.go +++ b/tests/robustness/traffic/client.go @@ -22,12 +22,11 @@ import ( "go.uber.org/zap" - "go.etcd.io/etcd/tests/v3/robustness/report" - "go.etcd.io/etcd/api/v3/mvccpb" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/tests/v3/robustness/identity" "go.etcd.io/etcd/tests/v3/robustness/model" + "go.etcd.io/etcd/tests/v3/robustness/report" ) // RecordingClient provides a semi etcd client (different interface than diff --git a/tests/robustness/traffic/traffic.go b/tests/robustness/traffic/traffic.go index ffa19499256..4d98d2c2652 100644 --- a/tests/robustness/traffic/traffic.go +++ b/tests/robustness/traffic/traffic.go @@ -23,10 +23,9 @@ import ( "go.uber.org/zap" "golang.org/x/time/rate" - "go.etcd.io/etcd/tests/v3/robustness/report" - "go.etcd.io/etcd/tests/v3/framework/e2e" "go.etcd.io/etcd/tests/v3/robustness/identity" + "go.etcd.io/etcd/tests/v3/robustness/report" ) var ( diff --git a/tests/robustness/validate/patch_history.go b/tests/robustness/validate/patch_history.go index aaa50713600..8cc22375275 100644 --- a/tests/robustness/validate/patch_history.go +++ b/tests/robustness/validate/patch_history.go @@ -17,9 +17,8 @@ package validate import ( "github.com/anishathalye/porcupine" - "go.etcd.io/etcd/tests/v3/robustness/report" - "go.etcd.io/etcd/tests/v3/robustness/model" + "go.etcd.io/etcd/tests/v3/robustness/report" "go.etcd.io/etcd/tests/v3/robustness/traffic" ) diff --git a/tests/robustness/validate/watch.go b/tests/robustness/validate/watch.go index c2bb2d0a39d..31afb26c1d9 100644 --- a/tests/robustness/validate/watch.go +++ b/tests/robustness/validate/watch.go @@ -20,9 +20,8 @@ import ( "github.com/google/go-cmp/cmp" - "go.etcd.io/etcd/tests/v3/robustness/report" - "go.etcd.io/etcd/tests/v3/robustness/model" + "go.etcd.io/etcd/tests/v3/robustness/report" ) func validateWatch(t *testing.T, cfg Config, reports []report.ClientReport) []model.WatchEvent { diff --git a/tools/.golangci.yaml b/tools/.golangci.yaml index 1f90573b7db..5ca02dfb28b 100644 --- a/tools/.golangci.yaml +++ b/tools/.golangci.yaml @@ -17,7 +17,7 @@ linters: # - deadcode # - structcheck # - varcheck - # - goimports # TODO: enable by #16610 + - goimports - ineffassign # - revive # TODO: enable by #16610 - staticcheck diff --git a/tools/benchmark/cmd/lease.go b/tools/benchmark/cmd/lease.go index 5b273c03265..2b91c35b21f 100644 --- a/tools/benchmark/cmd/lease.go +++ b/tools/benchmark/cmd/lease.go @@ -19,11 +19,11 @@ import ( "fmt" "time" - v3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/pkg/v3/report" - "github.com/cheggaaa/pb/v3" "github.com/spf13/cobra" + + v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/report" ) var leaseKeepaliveCmd = &cobra.Command{ diff --git a/tools/benchmark/cmd/put.go b/tools/benchmark/cmd/put.go index 5e3943ff22d..7011394a607 100644 --- a/tools/benchmark/cmd/put.go +++ b/tools/benchmark/cmd/put.go @@ -24,13 +24,13 @@ import ( "strings" "time" - v3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/pkg/v3/report" - "github.com/cheggaaa/pb/v3" "github.com/dustin/go-humanize" "github.com/spf13/cobra" "golang.org/x/time/rate" + + v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/report" ) // putCmd represents the put command diff --git a/tools/benchmark/cmd/range.go b/tools/benchmark/cmd/range.go index c593a42324f..111d69bd055 100644 --- a/tools/benchmark/cmd/range.go +++ b/tools/benchmark/cmd/range.go @@ -21,12 +21,12 @@ import ( "os" "time" - v3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/pkg/v3/report" - "github.com/cheggaaa/pb/v3" "github.com/spf13/cobra" "golang.org/x/time/rate" + + v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/report" ) // rangeCmd represents the range command diff --git a/tools/benchmark/cmd/root.go b/tools/benchmark/cmd/root.go index 0a22e031b95..d4481acf871 100644 --- a/tools/benchmark/cmd/root.go +++ b/tools/benchmark/cmd/root.go @@ -18,10 +18,10 @@ import ( "sync" "time" - "go.etcd.io/etcd/client/pkg/v3/transport" - "github.com/cheggaaa/pb/v3" "github.com/spf13/cobra" + + "go.etcd.io/etcd/client/pkg/v3/transport" ) // This represents the base command when called without any subcommands diff --git a/tools/benchmark/cmd/stm.go b/tools/benchmark/cmd/stm.go index eb3a5ee40a2..d6dfba0d397 100644 --- a/tools/benchmark/cmd/stm.go +++ b/tools/benchmark/cmd/stm.go @@ -23,14 +23,14 @@ import ( "os" "time" + "github.com/cheggaaa/pb/v3" + "github.com/spf13/cobra" + "golang.org/x/time/rate" + v3 "go.etcd.io/etcd/client/v3" v3sync "go.etcd.io/etcd/client/v3/concurrency" "go.etcd.io/etcd/pkg/v3/report" "go.etcd.io/etcd/server/v3/etcdserver/api/v3lock/v3lockpb" - - "github.com/cheggaaa/pb/v3" - "github.com/spf13/cobra" - "golang.org/x/time/rate" ) // stmCmd represents the STM benchmark command diff --git a/tools/benchmark/cmd/txn_mixed.go b/tools/benchmark/cmd/txn_mixed.go index d921285d944..ffc004ecfe2 100644 --- a/tools/benchmark/cmd/txn_mixed.go +++ b/tools/benchmark/cmd/txn_mixed.go @@ -23,12 +23,12 @@ import ( "os" "time" - v3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/pkg/v3/report" - "github.com/cheggaaa/pb/v3" "github.com/spf13/cobra" "golang.org/x/time/rate" + + v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/report" ) // mixeTxnCmd represents the mixedTxn command diff --git a/tools/benchmark/cmd/txn_put.go b/tools/benchmark/cmd/txn_put.go index 12990c6cbc1..d69293b838a 100644 --- a/tools/benchmark/cmd/txn_put.go +++ b/tools/benchmark/cmd/txn_put.go @@ -22,12 +22,12 @@ import ( "os" "time" - v3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/pkg/v3/report" - "github.com/cheggaaa/pb/v3" "github.com/spf13/cobra" "golang.org/x/time/rate" + + v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/report" ) // txnPutCmd represents the txnPut command diff --git a/tools/benchmark/cmd/watch.go b/tools/benchmark/cmd/watch.go index 3d687a0b555..72f42a1f7ee 100644 --- a/tools/benchmark/cmd/watch.go +++ b/tools/benchmark/cmd/watch.go @@ -23,12 +23,12 @@ import ( "sync/atomic" "time" - clientv3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/pkg/v3/report" - "github.com/cheggaaa/pb/v3" "github.com/spf13/cobra" "golang.org/x/time/rate" + + clientv3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/report" ) // watchCmd represents the watch command diff --git a/tools/benchmark/cmd/watch_get.go b/tools/benchmark/cmd/watch_get.go index 0397964ae80..b9a8bc3363d 100644 --- a/tools/benchmark/cmd/watch_get.go +++ b/tools/benchmark/cmd/watch_get.go @@ -20,11 +20,11 @@ import ( "sync" "time" - v3 "go.etcd.io/etcd/client/v3" - "go.etcd.io/etcd/pkg/v3/report" - "github.com/cheggaaa/pb/v3" "github.com/spf13/cobra" + + v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/report" ) // watchGetCmd represents the watch command diff --git a/tools/etcd-dump-logs/etcd-dump-log_test.go b/tools/etcd-dump-logs/etcd-dump-log_test.go index ae79d3fea94..e646e2e77fa 100644 --- a/tools/etcd-dump-logs/etcd-dump-log_test.go +++ b/tools/etcd-dump-logs/etcd-dump-log_test.go @@ -23,7 +23,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "go.uber.org/zap/zaptest" "go.etcd.io/etcd/api/v3/authpb" diff --git a/tools/etcd-dump-metrics/etcd.go b/tools/etcd-dump-metrics/etcd.go index e1e7ad7276f..6d95b3f8e7c 100644 --- a/tools/etcd-dump-metrics/etcd.go +++ b/tools/etcd-dump-metrics/etcd.go @@ -22,10 +22,10 @@ import ( "strings" "time" + "go.uber.org/zap" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/server/v3/embed" - - "go.uber.org/zap" ) func newEmbedURLs(n int) (urls []url.URL) { diff --git a/tools/etcd-dump-metrics/main.go b/tools/etcd-dump-metrics/main.go index ac97d5b86b4..18d517e450e 100644 --- a/tools/etcd-dump-metrics/main.go +++ b/tools/etcd-dump-metrics/main.go @@ -24,10 +24,10 @@ import ( "path/filepath" "time" + "go.uber.org/zap" + "go.etcd.io/etcd/client/pkg/v3/logutil" "go.etcd.io/etcd/server/v3/embed" - - "go.uber.org/zap" ) var lg *zap.Logger