From 56c4aaaaca2a124dc1e5002a1684867886b373a3 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 31 Oct 2024 09:38:45 +0300 Subject: [PATCH] [#292] .golangci.yml: Add intrange linter, fix warnings Signed-off-by: Evgenii Stratonikov --- .golangci.yml | 1 + eacl/record.go | 4 ++-- eacl/table.go | 2 +- eacl/target.go | 2 +- pool/tree/pool.go | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d3638fe..95a6fdc 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -64,5 +64,6 @@ linters: - gocognit - contextcheck - protogetter + - intrange disable-all: true fast: false diff --git a/eacl/record.go b/eacl/record.go index c808387..0165992 100644 --- a/eacl/record.go +++ b/eacl/record.go @@ -286,13 +286,13 @@ func equalRecords(r1, r2 Record) bool { return false } - for i := range len(fs1) { + for i := range fs1 { if !equalFilters(fs1[i], fs2[i]) { return false } } - for i := range len(ts1) { + for i := range ts1 { if !equalTargets(ts1[i], ts2[i]) { return false } diff --git a/eacl/table.go b/eacl/table.go index 3fc9e60..6d491e9 100644 --- a/eacl/table.go +++ b/eacl/table.go @@ -212,7 +212,7 @@ func EqualTables(t1, t2 Table) bool { return false } - for i := range len(rs1) { + for i := range rs1 { if !equalRecords(rs1[i], rs2[i]) { return false } diff --git a/eacl/target.go b/eacl/target.go index a2f9c36..dc6fdc2 100644 --- a/eacl/target.go +++ b/eacl/target.go @@ -169,7 +169,7 @@ func equalTargets(t1, t2 Target) bool { return false } - for i := range len(keys1) { + for i := range keys1 { if !bytes.Equal(keys1[i], keys2[i]) { return false } diff --git a/pool/tree/pool.go b/pool/tree/pool.go index 0d7c117..b04ab2c 100644 --- a/pool/tree/pool.go +++ b/pool/tree/pool.go @@ -382,7 +382,7 @@ type SubTreeReader struct { // Read reads another list of the subtree nodes. func (x *SubTreeReader) Read(buf []*grpcService.GetSubTreeResponse_Body) (int, error) { - for i := range len(buf) { + for i := range buf { resp, err := x.cli.Recv() if err == io.EOF { return i, io.EOF -- 2.45.2