Skip to content

Commit

Permalink
Fix linter reported issues
Browse files Browse the repository at this point in the history
Signed-off-by: Chun-Hung Tseng <[email protected]>
  • Loading branch information
henrybear327 committed Aug 16, 2024
1 parent 7f46c0b commit d8230d5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion raft_paper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion raft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion rawnode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d8230d5

Please sign in to comment.