From 0249c39cb36d544be6900ecd13a69c77227a6ea4 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Thu, 5 Jul 2018 10:12:45 -0700 Subject: [PATCH] raft: remove unnecessary type conversion Signed-off-by: Gyuho Lee --- raft/log_test.go | 4 ++-- raft/raft_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/raft/log_test.go b/raft/log_test.go index f80e41ce2..8fa60db84 100644 --- a/raft/log_test.go +++ b/raft/log_test.go @@ -282,11 +282,11 @@ func TestCompactionSideEffects(t *testing.T) { lastTerm := lastIndex storage := NewMemoryStorage() for i = 1; i <= unstableIndex; i++ { - storage.Append([]pb.Entry{{Term: uint64(i), Index: uint64(i)}}) + storage.Append([]pb.Entry{{Term: i, Index: i}}) } raftLog := newLog(storage, raftLogger) for i = unstableIndex; i < lastIndex; i++ { - raftLog.append(pb.Entry{Term: uint64(i + 1), Index: uint64(i + 1)}) + raftLog.append(pb.Entry{Term: i + 1, Index: i + 1}) } ok := raftLog.maybeCommit(lastIndex, lastTerm) diff --git a/raft/raft_test.go b/raft/raft_test.go index 90d0f060f..8d10ed89e 100644 --- a/raft/raft_test.go +++ b/raft/raft_test.go @@ -303,7 +303,7 @@ func TestLeaderElectionPreVote(t *testing.T) { func testLeaderElection(t *testing.T, preVote bool) { var cfg func(*Config) - candState := StateType(StateCandidate) + candState := StateCandidate candTerm := uint64(1) if preVote { cfg = preVoteConfig @@ -1675,7 +1675,7 @@ func TestAllServerStepdown(t *testing.T) { if sm.Term != tt.wterm { t.Errorf("#%d.%d term = %v , want %v", i, j, sm.Term, tt.wterm) } - if uint64(sm.raftLog.lastIndex()) != tt.windex { + if sm.raftLog.lastIndex() != tt.windex { t.Errorf("#%d.%d index = %v , want %v", i, j, sm.raftLog.lastIndex(), tt.windex) } if uint64(len(sm.raftLog.allEntries())) != tt.windex {