diff --git a/node_test.go b/node_test.go index a0c095db..2dce0df8 100644 --- a/node_test.go +++ b/node_test.go @@ -129,7 +129,7 @@ func TestNodeStepUnblock(t *testing.T) { // TestNodePropose ensures that node.Propose sends the given proposal to the underlying raft. func TestNodePropose(t *testing.T) { var msgs []raftpb.Message - appendStep := func(r *raft, m raftpb.Message) error { + appendStep := func(_ *raft, m raftpb.Message) error { t.Log(DescribeMessage(m, nil)) if m.Type == raftpb.MsgAppResp { return nil // injected by (*raft).advance @@ -240,7 +240,7 @@ func TestNodeReadIndexToOldLeader(t *testing.T) { // to the underlying raft. func TestNodeProposeConfig(t *testing.T) { var msgs []raftpb.Message - appendStep := func(r *raft, m raftpb.Message) error { + appendStep := func(_ *raft, m raftpb.Message) error { if m.Type == raftpb.MsgAppResp { return nil // injected by (*raft).advance } @@ -386,7 +386,7 @@ func TestBlockProposal(t *testing.T) { func TestNodeProposeWaitDropped(t *testing.T) { var msgs []raftpb.Message droppingMsg := []byte("test_dropping") - dropStep := func(r *raft, m raftpb.Message) error { + dropStep := func(_ *raft, m raftpb.Message) error { if m.Type == raftpb.MsgProp && strings.Contains(m.String(), string(droppingMsg)) { t.Logf("dropping message: %v", m.String()) return ErrProposalDropped diff --git a/raft.go b/raft.go index 8ba456e0..079b81a5 100644 --- a/raft.go +++ b/raft.go @@ -2015,7 +2015,7 @@ func (r *raft) switchToConfig(cfg tracker.Config, trk tracker.ProgressMap) pb.Co // Otherwise, still probe the newly added replicas; there's no reason to // let them wait out a heartbeat interval (or the next incoming // proposal). - r.trk.Visit(func(id uint64, pr *tracker.Progress) { + r.trk.Visit(func(id uint64, _ *tracker.Progress) { if id == r.id { return } diff --git a/raft_paper_test.go b/raft_paper_test.go index 7936a276..45dc625b 100644 --- a/raft_paper_test.go +++ b/raft_paper_test.go @@ -76,7 +76,7 @@ func testUpdateTermFromMessage(t *testing.T, state StateType) { // Reference: section 5.1 func TestRejectStaleTermMessage(t *testing.T) { called := false - fakeStep := func(r *raft, m pb.Message) error { + fakeStep := func(_ *raft, _ pb.Message) error { called = true return nil } diff --git a/raft_test.go b/raft_test.go index b72c2324..85bbcce7 100644 --- a/raft_test.go +++ b/raft_test.go @@ -1073,7 +1073,7 @@ func TestPastElectionTimeout(t *testing.T) { // from old term and does not pass it to the actual stepX function. func TestStepIgnoreOldTermMsg(t *testing.T) { called := false - fakeStep := func(r *raft, m pb.Message) error { + fakeStep := func(_ *raft, _ pb.Message) error { called = true return nil } diff --git a/rawnode_test.go b/rawnode_test.go index d620533a..4d93f06f 100644 --- a/rawnode_test.go +++ b/rawnode_test.go @@ -509,7 +509,7 @@ func TestRawNodeProposeAddDuplicateNode(t *testing.T) { // to the underlying raft. It also ensures that ReadState can be read out. func TestRawNodeReadIndex(t *testing.T) { var msgs []pb.Message - appendStep := func(r *raft, m pb.Message) error { + appendStep := func(_ *raft, m pb.Message) error { msgs = append(msgs, m) return nil }