From 854807c47ae76de8cdf7e8e86476af7b0d499bde Mon Sep 17 00:00:00 2001 From: Chun-Hung Tseng Date: Thu, 15 Aug 2024 00:09:03 +0200 Subject: [PATCH 1/3] Bump go toolchain to 1.23.0 Reference: - https://github.com/etcd-io/etcd/issues/18443 Signed-off-by: Chun-Hung Tseng --- .go-version | 2 +- go.mod | 4 ++-- tools/mod/go.mod | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.go-version b/.go-version index 054c858f..a6c2798a 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.22.5 \ No newline at end of file +1.23.0 diff --git a/go.mod b/go.mod index 85f74c17..8c2841f0 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module go.etcd.io/raft/v3 -go 1.22 +go 1.23 -toolchain go1.22.6 +toolchain go1.23.0 require ( github.com/cockroachdb/datadriven v1.0.2 diff --git a/tools/mod/go.mod b/tools/mod/go.mod index e6e18817..2ae18ad6 100644 --- a/tools/mod/go.mod +++ b/tools/mod/go.mod @@ -1,8 +1,8 @@ module go.etcd.io/raft/tools/v3 -go 1.22 +go 1.23 -toolchain go1.22.6 +toolchain go1.23.0 require ( github.com/alexkohler/nakedret v1.0.0 From 7f46c0b7a54da69dfe1fa5932df2a325b52d54c1 Mon Sep 17 00:00:00 2001 From: Chun-Hung Tseng Date: Thu, 15 Aug 2024 00:19:35 +0200 Subject: [PATCH 2/3] Update golangci-lint to v1.60.1 Reference: - https://github.com/golangci/golangci-lint/releases/tag/v1.60.1 Signed-off-by: Chun-Hung Tseng --- .github/workflows/static-analysis.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index edf32e1f..dc0d3c47 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -13,7 +13,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 with: - version: v1.55.2 + version: v1.60.1 - name: protoc uses: arduino/setup-protoc@149f6c87b92550901b26acd1632e11c3662e381f # v1.3.0 with: From d8230d5c6264397deec825685ae939ff1f5387cf Mon Sep 17 00:00:00 2001 From: Chun-Hung Tseng Date: Fri, 16 Aug 2024 17:02:08 +0200 Subject: [PATCH 3/3] Fix linter reported issues Signed-off-by: Chun-Hung Tseng --- node_test.go | 6 +++--- raft.go | 2 +- raft_paper_test.go | 2 +- raft_test.go | 2 +- rawnode_test.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) 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 }