From 7ee8a81ffd2d6ca7ee3af47b4f2663deb1da43eb Mon Sep 17 00:00:00 2001 From: James Blair Date: Sun, 6 Aug 2023 06:30:14 +1200 Subject: [PATCH] Fix lint errors. Signed-off-by: James Blair --- example_test.go | 8 ++++---- node_test.go | 2 +- rafttest/interaction_env_handler.go | 2 +- rafttest/interaction_env_handler_campaign.go | 4 ++-- rafttest/interaction_env_handler_forget_leader.go | 4 ++-- rafttest/interaction_env_handler_log_level.go | 3 +-- rawnode_test.go | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/example_test.go b/example_test.go index a693ddea8363..9e34a3f2dd2b 100644 --- a/example_test.go +++ b/example_test.go @@ -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{} diff --git a/node_test.go b/node_test.go index 068002b85c4c..281ada19294f 100644 --- a/node_test.go +++ b/node_test.go @@ -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) } diff --git a/rafttest/interaction_env_handler.go b/rafttest/interaction_env_handler.go index c4c84fe6b006..30b83b8f74e0 100644 --- a/rafttest/interaction_env_handler.go +++ b/rafttest/interaction_env_handler.go @@ -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. // diff --git a/rafttest/interaction_env_handler_campaign.go b/rafttest/interaction_env_handler_campaign.go index bde5cc42e1f1..8b6ccbc1f48d 100644 --- a/rafttest/interaction_env_handler_campaign.go +++ b/rafttest/interaction_env_handler_campaign.go @@ -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() } diff --git a/rafttest/interaction_env_handler_forget_leader.go b/rafttest/interaction_env_handler_forget_leader.go index 8884e0d60d36..b239db75e1d2 100644 --- a/rafttest/interaction_env_handler_forget_leader.go +++ b/rafttest/interaction_env_handler_forget_leader.go @@ -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() } diff --git a/rafttest/interaction_env_handler_log_level.go b/rafttest/interaction_env_handler_log_level.go index 2194c9ee1a18..c517a4d77d6a 100644 --- a/rafttest/interaction_env_handler_log_level.go +++ b/rafttest/interaction_env_handler_log_level.go @@ -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) } diff --git a/rawnode_test.go b/rawnode_test.go index e570be3b791f..4dbccab3ce1c 100644 --- a/rawnode_test.go +++ b/rawnode_test.go @@ -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) }