Skip to content

Commit

Permalink
Fix lint errors.
Browse files Browse the repository at this point in the history
Signed-off-by: James Blair <[email protected]>
  • Loading branch information
jmhbnz committed Aug 5, 2023
1 parent 2868941 commit 7ee8a81
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
pb "go.etcd.io/raft/v3/raftpb"
)

func applyToStore(ents []pb.Entry) {}
func sendMessages(msgs []pb.Message) {}
func saveStateToDisk(st pb.HardState) {}
func saveToDisk(ents []pb.Entry) {}
func applyToStore(_ []pb.Entry) {}
func sendMessages(_ []pb.Message) {}
func saveStateToDisk(_ pb.HardState) {}
func saveToDisk(_ []pb.Entry) {}

func ExampleNode() {
c := &Config{}
Expand Down
2 changes: 1 addition & 1 deletion node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ type ignoreSizeHintMemStorage struct {
*MemoryStorage
}

func (s *ignoreSizeHintMemStorage) Entries(lo, hi uint64, maxSize uint64) ([]raftpb.Entry, error) {
func (s *ignoreSizeHintMemStorage) Entries(lo, hi uint64, _ uint64) ([]raftpb.Entry, error) {
return s.MemoryStorage.Entries(lo, hi, math.MaxUint64)
}

Expand Down
2 changes: 1 addition & 1 deletion rafttest/interaction_env_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (env *InteractionEnv) Handle(t *testing.T, d datadriven.TestData) string {
// Example:
//
// log-level WARN
err = env.handleLogLevel(t, d)
err = env.handleLogLevel(d)
case "raft-log":
// Print the Raft log.
//
Expand Down
4 changes: 2 additions & 2 deletions rafttest/interaction_env_handler_campaign.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (

func (env *InteractionEnv) handleCampaign(t *testing.T, d datadriven.TestData) error {
idx := firstAsNodeIdx(t, d)
return env.Campaign(t, idx)
return env.Campaign(idx)
}

// Campaign the node at the given index.
func (env *InteractionEnv) Campaign(t *testing.T, idx int) error {
func (env *InteractionEnv) Campaign(idx int) error {
return env.Nodes[idx].Campaign()
}
4 changes: 2 additions & 2 deletions rafttest/interaction_env_handler_forget_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (

func (env *InteractionEnv) handleForgetLeader(t *testing.T, d datadriven.TestData) error {
idx := firstAsNodeIdx(t, d)
env.ForgetLeader(t, idx)
env.ForgetLeader(idx)
return nil
}

// ForgetLeader makes the follower at the given index forget its leader.
func (env *InteractionEnv) ForgetLeader(t *testing.T, idx int) {
func (env *InteractionEnv) ForgetLeader(idx int) {
env.Nodes[idx].ForgetLeader()
}
3 changes: 1 addition & 2 deletions rafttest/interaction_env_handler_log_level.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ package rafttest
import (
"fmt"
"strings"
"testing"

"github.com/cockroachdb/datadriven"
)

func (env *InteractionEnv) handleLogLevel(t *testing.T, d datadriven.TestData) error {
func (env *InteractionEnv) handleLogLevel(d datadriven.TestData) error {
return env.LogLevel(d.CmdArgs[0].Key)
}

Expand Down
2 changes: 1 addition & 1 deletion rawnode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type rawNodeAdapter struct {
var _ Node = (*rawNodeAdapter)(nil)

// TransferLeadership is to test when node specifies lead, which is pointless, can just be filled in.
func (a *rawNodeAdapter) TransferLeadership(ctx context.Context, lead, transferee uint64) {
func (a *rawNodeAdapter) TransferLeadership(_ context.Context, _, transferee uint64) {
a.RawNode.TransferLeader(transferee)
}

Expand Down

0 comments on commit 7ee8a81

Please sign in to comment.