From 9bf2be11eda82ba599512740d08a72fac70782eb Mon Sep 17 00:00:00 2001 From: Denis Gudim Date: Mon, 26 Dec 2022 19:04:34 +0300 Subject: [PATCH] fix(raft) removed dead code and fixed linter issues --- raft/etcd/logger.go | 2 -- raft/etcd/raft.go | 7 ------- 2 files changed, 9 deletions(-) diff --git a/raft/etcd/logger.go b/raft/etcd/logger.go index ad4b5c08c4..4840cf30d8 100644 --- a/raft/etcd/logger.go +++ b/raft/etcd/logger.go @@ -16,7 +16,6 @@ package etcd import ( "fmt" - "io/ioutil" "log" "os" ) @@ -45,7 +44,6 @@ func SetLogger(l Logger) { raftLogger = l } var ( defaultLogger = &DefaultLogger{Logger: log.New(os.Stderr, "raft", log.Ldate|log.Lmicroseconds)} - discardLogger = &DefaultLogger{Logger: log.New(ioutil.Discard, "", 0)} raftLogger = Logger(defaultLogger) ) diff --git a/raft/etcd/raft.go b/raft/etcd/raft.go index 8a27f476da..8f39574b84 100644 --- a/raft/etcd/raft.go +++ b/raft/etcd/raft.go @@ -38,7 +38,6 @@ const ( StateCandidate StateLeader StatePreCandidate - numStates ) type ReadOnlyOption int @@ -1250,12 +1249,6 @@ func (r *raft) handleSnapshot(m pb.Message) { } } -func (r *raft) initialized() bool { - // empty 'prs' and 'learnerPrs' means that - // this peer is newly created by conf change - return len(r.prs) > 0 || len(r.learnerPrs) > 0 -} - // restore recovers the state machine from a snapshot. It restores the log and the // configuration of state machine. func (r *raft) restore(s pb.Snapshot) bool {