From b798aae9c5c4475f5854b66bef66fd8b1ad79cb8 Mon Sep 17 00:00:00 2001 From: iuriatan Date: Thu, 13 Jul 2023 17:44:53 -0300 Subject: [PATCH 1/3] Update golangci-lint from 1.49.0 to 1.53.3 Signed-off-by: iuriatan --- .github/workflows/static-analysis.yaml | 2 +- contrib/raftexample/raft.go | 2 +- contrib/raftexample/raftexample_test.go | 4 ++-- tools/benchmark/cmd/lease.go | 2 +- tools/benchmark/cmd/mvcc-put.go | 2 +- tools/benchmark/cmd/mvcc.go | 2 +- tools/benchmark/cmd/put.go | 2 +- tools/benchmark/cmd/stm.go | 2 +- tools/benchmark/cmd/txn_mixed.go | 2 +- tools/benchmark/cmd/txn_put.go | 2 +- tools/benchmark/cmd/watch.go | 2 +- tools/benchmark/cmd/watch_get.go | 2 +- tools/benchmark/cmd/watch_latency.go | 2 +- tools/etcd-dump-db/backend.go | 4 ++-- tools/etcd-dump-db/main.go | 6 +++--- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index 9961c69c7..4ddaf8ecf 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -15,7 +15,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0 with: - version: v1.49.0 + version: v1.53.3 args: --config tools/.golangci.yaml - name: protoc uses: arduino/setup-protoc@149f6c87b92550901b26acd1632e11c3662e381f # v1.3.0 diff --git a/contrib/raftexample/raft.go b/contrib/raftexample/raft.go index 971141ae3..14f1aca80 100644 --- a/contrib/raftexample/raft.go +++ b/contrib/raftexample/raft.go @@ -515,7 +515,7 @@ func (rc *raftNode) serveRaft() { func (rc *raftNode) Process(ctx context.Context, m raftpb.Message) error { return rc.node.Step(ctx, m) } -func (rc *raftNode) IsIDRemoved(id uint64) bool { return false } +func (rc *raftNode) IsIDRemoved(_ uint64) bool { return false } func (rc *raftNode) ReportUnreachable(id uint64) { rc.node.ReportUnreachable(id) } func (rc *raftNode) ReportSnapshot(id uint64, status raft.SnapshotStatus) { rc.node.ReportSnapshot(id, status) diff --git a/contrib/raftexample/raftexample_test.go b/contrib/raftexample/raftexample_test.go index 6a8e52746..784f66801 100644 --- a/contrib/raftexample/raftexample_test.go +++ b/contrib/raftexample/raftexample_test.go @@ -78,7 +78,7 @@ func newCluster(n int) *cluster { func (clus *cluster) Close() (err error) { for i := range clus.peers { go func(i int) { - for range clus.commitC[i] { + for range clus.commitC[i] { //revive:disable-line:empty-block // drain pending commits } }(i) @@ -125,7 +125,7 @@ func TestProposeOnCommit(t *testing.T) { } } donec <- struct{}{} - for range cC { + for range cC { //revive:disable-line:empty-block // acknowledge the commits from other nodes so // raft continues to make progress } diff --git a/tools/benchmark/cmd/lease.go b/tools/benchmark/cmd/lease.go index 2ade5897d..5b273c032 100644 --- a/tools/benchmark/cmd/lease.go +++ b/tools/benchmark/cmd/lease.go @@ -42,7 +42,7 @@ func init() { leaseKeepaliveCmd.Flags().IntVar(&leaseKeepaliveTotal, "total", 10000, "Total number of lease keepalive requests") } -func leaseKeepaliveFunc(cmd *cobra.Command, args []string) { +func leaseKeepaliveFunc(_ *cobra.Command, _ []string) { requests := make(chan struct{}) clients := mustCreateClients(totalClients, totalConns) diff --git a/tools/benchmark/cmd/mvcc-put.go b/tools/benchmark/cmd/mvcc-put.go index 11ca074f0..c175dbfb1 100644 --- a/tools/benchmark/cmd/mvcc-put.go +++ b/tools/benchmark/cmd/mvcc-put.go @@ -70,7 +70,7 @@ func createBytesSlice(bytesN, sliceN int) [][]byte { return rs } -func mvccPutFunc(cmd *cobra.Command, args []string) { +func mvccPutFunc(_ *cobra.Command, _ []string) { if cpuProfPath != "" { f, err := os.Create(cpuProfPath) if err != nil { diff --git a/tools/benchmark/cmd/mvcc.go b/tools/benchmark/cmd/mvcc.go index 1d51c5237..baf2bf1a1 100644 --- a/tools/benchmark/cmd/mvcc.go +++ b/tools/benchmark/cmd/mvcc.go @@ -59,6 +59,6 @@ func init() { mvccCmd.PersistentFlags().IntVar(&batchLimit, "batch-limit", 10000, "A limit of batched transaction") } -func mvccPreRun(cmd *cobra.Command, args []string) { +func mvccPreRun(_ *cobra.Command, _ []string) { initMVCC() } diff --git a/tools/benchmark/cmd/put.go b/tools/benchmark/cmd/put.go index 7208fd352..5e3943ff2 100644 --- a/tools/benchmark/cmd/put.go +++ b/tools/benchmark/cmd/put.go @@ -71,7 +71,7 @@ func init() { putCmd.Flags().BoolVar(&checkHashkv, "check-hashkv", false, "'true' to check hashkv") } -func putFunc(cmd *cobra.Command, args []string) { +func putFunc(cmd *cobra.Command, _ []string) { if keySpaceSize <= 0 { fmt.Fprintf(os.Stderr, "expected positive --key-space-size, got (%v)", keySpaceSize) os.Exit(1) diff --git a/tools/benchmark/cmd/stm.go b/tools/benchmark/cmd/stm.go index e5c1ad5e7..eb3a5ee40 100644 --- a/tools/benchmark/cmd/stm.go +++ b/tools/benchmark/cmd/stm.go @@ -69,7 +69,7 @@ func init() { stmCmd.Flags().IntVar(&stmRate, "rate", 0, "Maximum STM transactions per second (0 is no limit)") } -func stmFunc(cmd *cobra.Command, args []string) { +func stmFunc(cmd *cobra.Command, _ []string) { if stmKeyCount <= 0 { fmt.Fprintf(os.Stderr, "expected positive --keys, got (%v)", stmKeyCount) os.Exit(1) diff --git a/tools/benchmark/cmd/txn_mixed.go b/tools/benchmark/cmd/txn_mixed.go index c5265e81d..d921285d9 100644 --- a/tools/benchmark/cmd/txn_mixed.go +++ b/tools/benchmark/cmd/txn_mixed.go @@ -69,7 +69,7 @@ type request struct { op v3.Op } -func mixedTxnFunc(cmd *cobra.Command, args []string) { +func mixedTxnFunc(cmd *cobra.Command, _ []string) { if keySpaceSize <= 0 { fmt.Fprintf(os.Stderr, "expected positive --key-space-size, got (%v)", keySpaceSize) os.Exit(1) diff --git a/tools/benchmark/cmd/txn_put.go b/tools/benchmark/cmd/txn_put.go index bea02f7ac..12990c6cb 100644 --- a/tools/benchmark/cmd/txn_put.go +++ b/tools/benchmark/cmd/txn_put.go @@ -55,7 +55,7 @@ func init() { txnPutCmd.Flags().IntVar(&keySpaceSize, "key-space-size", 1, "Maximum possible keys") } -func txnPutFunc(cmd *cobra.Command, args []string) { +func txnPutFunc(_ *cobra.Command, _ []string) { if keySpaceSize <= 0 { fmt.Fprintf(os.Stderr, "expected positive --key-space-size, got (%v)", keySpaceSize) os.Exit(1) diff --git a/tools/benchmark/cmd/watch.go b/tools/benchmark/cmd/watch.go index 110b372db..3d687a0b5 100644 --- a/tools/benchmark/cmd/watch.go +++ b/tools/benchmark/cmd/watch.go @@ -88,7 +88,7 @@ func init() { watchCmd.Flags().BoolVar(&watchSeqKeys, "sequential-keys", false, "Use sequential keys") } -func watchFunc(cmd *cobra.Command, args []string) { +func watchFunc(_ *cobra.Command, _ []string) { if watchKeySpaceSize <= 0 { fmt.Fprintf(os.Stderr, "expected positive --key-space-size, got (%v)", watchKeySpaceSize) os.Exit(1) diff --git a/tools/benchmark/cmd/watch_get.go b/tools/benchmark/cmd/watch_get.go index c70091b9c..0397964ae 100644 --- a/tools/benchmark/cmd/watch_get.go +++ b/tools/benchmark/cmd/watch_get.go @@ -49,7 +49,7 @@ func init() { watchGetCmd.Flags().IntVar(&watchEvents, "events", 8, "Number of events per watcher") } -func watchGetFunc(cmd *cobra.Command, args []string) { +func watchGetFunc(_ *cobra.Command, _ []string) { clients := mustCreateClients(totalClients, totalConns) getClient := mustCreateClients(1, 1) diff --git a/tools/benchmark/cmd/watch_latency.go b/tools/benchmark/cmd/watch_latency.go index 31ceb3b32..b51cb0752 100644 --- a/tools/benchmark/cmd/watch_latency.go +++ b/tools/benchmark/cmd/watch_latency.go @@ -54,7 +54,7 @@ func init() { watchLatencyCmd.Flags().IntVar(&watchLValueSize, "val-size", 32, "Value size of watch response") } -func watchLatencyFunc(cmd *cobra.Command, args []string) { +func watchLatencyFunc(_ *cobra.Command, _ []string) { key := string(mustRandBytes(watchLKeySize)) value := string(mustRandBytes(watchLValueSize)) diff --git a/tools/etcd-dump-db/backend.go b/tools/etcd-dump-db/backend.go index 50619d95d..5c9df5e42 100644 --- a/tools/etcd-dump-db/backend.go +++ b/tools/etcd-dump-db/backend.go @@ -113,7 +113,7 @@ func authDecoder(k, v []byte) { } } -func authRolesDecoder(k, v []byte) { +func authRolesDecoder(_, v []byte) { role := &authpb.Role{} err := role.Unmarshal(v) if err != nil { @@ -122,7 +122,7 @@ func authRolesDecoder(k, v []byte) { fmt.Printf("role=%q, keyPermission=%v\n", string(role.Name), role.KeyPermission) } -func authUsersDecoder(k, v []byte) { +func authUsersDecoder(_, v []byte) { user := &authpb.User{} err := user.Unmarshal(v) if err != nil { diff --git a/tools/etcd-dump-db/main.go b/tools/etcd-dump-db/main.go index f82d91f76..95e6c4392 100644 --- a/tools/etcd-dump-db/main.go +++ b/tools/etcd-dump-db/main.go @@ -68,7 +68,7 @@ func main() { } } -func listBucketCommandFunc(cmd *cobra.Command, args []string) { +func listBucketCommandFunc(_ *cobra.Command, args []string) { if len(args) < 1 { log.Fatalf("Must provide at least 1 argument (got %v)", args) } @@ -89,7 +89,7 @@ func listBucketCommandFunc(cmd *cobra.Command, args []string) { } } -func iterateBucketCommandFunc(cmd *cobra.Command, args []string) { +func iterateBucketCommandFunc(_ *cobra.Command, args []string) { if len(args) != 2 { log.Fatalf("Must provide 2 arguments (got %v)", args) } @@ -107,7 +107,7 @@ func iterateBucketCommandFunc(cmd *cobra.Command, args []string) { } } -func getHashCommandFunc(cmd *cobra.Command, args []string) { +func getHashCommandFunc(_ *cobra.Command, args []string) { if len(args) < 1 { log.Fatalf("Must provide at least 1 argument (got %v)", args) } From abbfc2964a06290076101b1de0bfb6753465203e Mon Sep 17 00:00:00 2001 From: iuriatan Date: Fri, 14 Jul 2023 09:40:46 -0300 Subject: [PATCH 2/3] Fix goword issue Fix `make verify` issues after updating golangci-lint Signed-off-by: iuriatan --- server/etcdserver/api/rafthttp/transport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/etcdserver/api/rafthttp/transport.go b/server/etcdserver/api/rafthttp/transport.go index 339c5734b..f4070044b 100644 --- a/server/etcdserver/api/rafthttp/transport.go +++ b/server/etcdserver/api/rafthttp/transport.go @@ -110,7 +110,7 @@ type Transport struct { Raft Raft // raft state machine, to which the Transport forwards received messages and reports status Snapshotter *snap.Snapshotter ServerStats *stats.ServerStats // used to record general transportation statistics - // used to record transportation statistics with followers when + // LeaderStats records transportation statistics with followers when // performing as leader in raft protocol LeaderStats *stats.LeaderStats // ErrorC is used to report detected critical errors, e.g., From b424e6028985f357794f5a0594e6667ddf4bee07 Mon Sep 17 00:00:00 2001 From: iuriatan Date: Fri, 14 Jul 2023 09:42:19 -0300 Subject: [PATCH 3/3] Update protoc from 3.14.0 to 3.20.3 Signed-off-by: iuriatan --- .github/workflows/static-analysis.yaml | 2 +- scripts/genproto.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index 4ddaf8ecf..34da16cef 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -20,7 +20,7 @@ jobs: - name: protoc uses: arduino/setup-protoc@149f6c87b92550901b26acd1632e11c3662e381f # v1.3.0 with: - version: '3.14.0' + version: '3.20.3' repo-token: ${{ secrets.GITHUB_TOKEN }} - run: | set -euo pipefail diff --git a/scripts/genproto.sh b/scripts/genproto.sh index d0aa4664e..782a16906 100755 --- a/scripts/genproto.sh +++ b/scripts/genproto.sh @@ -14,8 +14,8 @@ fi source ./scripts/test_lib.sh -if [[ $(protoc --version | cut -f2 -d' ') != "3.14.0" ]]; then - echo "could not find protoc 3.14.0, is it installed + in PATH?" +if [[ $(protoc --version | cut -f2 -d' ') != "3.20.3" ]]; then + echo "could not find protoc 3.20.3, is it installed + in PATH?" exit 255 fi