From 2e9edeec3b4d0a1b5ffa8000231f49f47790b62e Mon Sep 17 00:00:00 2001 From: Alex Aizman Date: Tue, 10 Sep 2024 13:14:38 -0400 Subject: [PATCH] lint * golangci 1.61.0 (was 1.60.2) Signed-off-by: Alex Aizman --- .github/workflows/lint.yml | 2 +- Makefile | 2 +- ais/test/etl_test.go | 2 +- ais/test/object_test.go | 2 +- cmd/cli/cli/utils.go | 4 ++-- cmd/cli/teb/disk.go | 2 +- core/namelocker.go | 2 +- hk/housekeeper_test.go | 2 +- transport/obj_test.go | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d5492814fe..b21414c284 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -29,7 +29,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: # NOTE: See `lint-update-ci` target in Makefile. - version: v1.60.2 + version: v1.61.0 args: --timeout=30m - name: Lint diff --git a/Makefile b/Makefile index 980417a942..9c041c0590 100644 --- a/Makefile +++ b/Makefile @@ -257,7 +257,7 @@ lint-update: ## See also: .github/workflows/lint.yml lint-update-ci: @rm -f $(GOPATH)/bin/golangci-lint - @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.60.2 + @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.61.0 lint: @([[ -x "$(command -v golangci-lint)" ]] && echo "Cannot find golangci-lint, run 'make lint-update' to install" && exit 1) || true diff --git a/ais/test/etl_test.go b/ais/test/etl_test.go index 9c7db8ceac..a24343bd08 100644 --- a/ais/test/etl_test.go +++ b/ais/test/etl_test.go @@ -100,7 +100,7 @@ func tfRecordsEqual(examples1, examples2 []*core.TFExample) (bool, error) { return examples2[i].GetFeature("__key__").String() < examples2[j].GetFeature("__key__").String() }) - for i := range len(examples1) { + for i := range examples1 { if !reflect.DeepEqual(examples1[i].ProtoReflect(), examples2[i].ProtoReflect()) { return false, nil } diff --git a/ais/test/object_test.go b/ais/test/object_test.go index fa4d9ceec8..fc5ef8c0eb 100644 --- a/ais/test/object_test.go +++ b/ais/test/object_test.go @@ -1392,7 +1392,7 @@ func verifyValidRanges(t *testing.T, proxyURL string, bck cmn.Bck, cksumType, ob t.Errorf("Returned bytes don't match expected length. Expected length: [%d]. Output length: [%d]", expectedLength, len(outputBytes)) } - for i := range len(expectedBytes) { + for i := range expectedBytes { if expectedBytes[i] != outputBytes[i] { t.Errorf("Byte mismatch. Expected: %v, Actual: %v", string(expectedBytes), string(outputBytes)) } diff --git a/cmd/cli/cli/utils.go b/cmd/cli/cli/utils.go index cc1540ff13..e0dd8dd011 100644 --- a/cmd/cli/cli/utils.go +++ b/cmd/cli/cli/utils.go @@ -153,7 +153,7 @@ func findClosestCommand(cmd string, candidates []cli.Command) (result string, di minDist = math.MaxInt64 closestName string ) - for i := range len(candidates) { + for i := range candidates { dist := DamerauLevenstheinDistance(cmd, candidates[i].Name) if dist < minDist { minDist = dist @@ -839,7 +839,7 @@ func _printSection(c *cli.Context, in any, section string) (done bool) { // resort to counting nested structures var cnt, off int res = out[from[0]:] - for off = range len(res) { + for off = range res { if res[off] == '{' { cnt++ } else if res[off] == '}' { diff --git a/cmd/cli/teb/disk.go b/cmd/cli/teb/disk.go index 58abf61dae..d419e1ed63 100644 --- a/cmd/cli/teb/disk.go +++ b/cmd/cli/teb/disk.go @@ -119,7 +119,7 @@ func _flt(cols []*header, regex *regexp.Regexp) []*header { } func _idx(cols []*header, name string) int { - for i := range len(cols) { + for i := range cols { if cols[i].name == name { return i } diff --git a/core/namelocker.go b/core/namelocker.go index a673e9c98b..fae27ffda0 100644 --- a/core/namelocker.go +++ b/core/namelocker.go @@ -67,7 +67,7 @@ const ( func newNameLocker() (nl nameLocker) { nl = make(nameLocker, cos.MultiSyncMapCount) - for idx := range len(nl) { + for idx := range nl { nl[idx].init() } return diff --git a/hk/housekeeper_test.go b/hk/housekeeper_test.go index 7a2e6235b4..7dd8deefca 100644 --- a/hk/housekeeper_test.go +++ b/hk/housekeeper_test.go @@ -65,7 +65,7 @@ var _ = Describe("Housekeeper", func() { time.Sleep(20 * time.Millisecond) // "foo" and "bar" should fire at the start (no initial interval) - for idx := range len(fired) { + for idx := range fired { Expect(fired[idx]).To(BeTrue()) fired[idx] = false } diff --git a/transport/obj_test.go b/transport/obj_test.go index a350e8a438..c1e8425a12 100644 --- a/transport/obj_test.go +++ b/transport/obj_test.go @@ -347,7 +347,7 @@ func TestSendCallback(t *testing.T) { posted = make([]*randReader, objectCnt) ) random := newRand(mono.NanoTime()) - for idx := range len(posted) { + for idx := range posted { hdr, rr := makeRandReader(random, false) mu.Lock() posted[idx] = rr