From d9e197f3bee2ad884cb38c62dfe7c335c6680141 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Fri, 3 Jan 2025 18:01:27 +0800 Subject: [PATCH] linter: upgrade intrange (#58432) --- DEPS.bzl | 48 ++++++++++++++-------------- build/nogo_config.json | 1 + go.mod | 4 +-- go.sum | 14 ++++---- pkg/util/checksum/checksum_test.go | 2 +- pkg/util/encrypt/crypt.go | 6 ++-- pkg/util/extsort/disk_sorter_test.go | 2 +- 7 files changed, 40 insertions(+), 37 deletions(-) diff --git a/DEPS.bzl b/DEPS.bzl index a54bbbdb1f8f5..e4e90f2379ac3 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -1009,13 +1009,13 @@ def go_deps(): name = "com_github_ckaznocha_intrange", build_file_proto_mode = "disable_global", importpath = "github.com/ckaznocha/intrange", - sha256 = "2cdefa74cabc9bfe27168929f68fe2927143899e8a340e932d030c3206101d82", - strip_prefix = "github.com/ckaznocha/intrange@v0.2.1", + sha256 = "8c9b74bc3df51e986b2a0aa1ff51b78c851ea3a8144bd04d5ff0845876fbfafd", + strip_prefix = "github.com/ckaznocha/intrange@v0.3.0", urls = [ - "http://bazel-cache.pingcap.net:8080/gomod/github.com/ckaznocha/intrange/com_github_ckaznocha_intrange-v0.2.1.zip", - "http://ats.apps.svc/gomod/github.com/ckaznocha/intrange/com_github_ckaznocha_intrange-v0.2.1.zip", - "https://cache.hawkingrei.com/gomod/github.com/ckaznocha/intrange/com_github_ckaznocha_intrange-v0.2.1.zip", - "https://storage.googleapis.com/pingcapmirror/gomod/github.com/ckaznocha/intrange/com_github_ckaznocha_intrange-v0.2.1.zip", + "http://bazel-cache.pingcap.net:8080/gomod/github.com/ckaznocha/intrange/com_github_ckaznocha_intrange-v0.3.0.zip", + "http://ats.apps.svc/gomod/github.com/ckaznocha/intrange/com_github_ckaznocha_intrange-v0.3.0.zip", + "https://cache.hawkingrei.com/gomod/github.com/ckaznocha/intrange/com_github_ckaznocha_intrange-v0.3.0.zip", + "https://storage.googleapis.com/pingcapmirror/gomod/github.com/ckaznocha/intrange/com_github_ckaznocha_intrange-v0.3.0.zip", ], ) go_repository( @@ -3440,13 +3440,13 @@ def go_deps(): name = "com_github_gostaticanalysis_testutil", build_file_proto_mode = "disable_global", importpath = "github.com/gostaticanalysis/testutil", - sha256 = "c20a660c72175ae026ee2c0488037babd93da54f5d8bed0fa9252f268f2a518b", - strip_prefix = "github.com/gostaticanalysis/testutil@v0.4.0", + sha256 = "f432719688dd131fcbd50b8c37d986487fa3cc3bd7bc0a32f19a739b6786133f", + strip_prefix = "github.com/gostaticanalysis/testutil@v0.5.0", urls = [ - "http://bazel-cache.pingcap.net:8080/gomod/github.com/gostaticanalysis/testutil/com_github_gostaticanalysis_testutil-v0.4.0.zip", - "http://ats.apps.svc/gomod/github.com/gostaticanalysis/testutil/com_github_gostaticanalysis_testutil-v0.4.0.zip", - "https://cache.hawkingrei.com/gomod/github.com/gostaticanalysis/testutil/com_github_gostaticanalysis_testutil-v0.4.0.zip", - "https://storage.googleapis.com/pingcapmirror/gomod/github.com/gostaticanalysis/testutil/com_github_gostaticanalysis_testutil-v0.4.0.zip", + "http://bazel-cache.pingcap.net:8080/gomod/github.com/gostaticanalysis/testutil/com_github_gostaticanalysis_testutil-v0.5.0.zip", + "http://ats.apps.svc/gomod/github.com/gostaticanalysis/testutil/com_github_gostaticanalysis_testutil-v0.5.0.zip", + "https://cache.hawkingrei.com/gomod/github.com/gostaticanalysis/testutil/com_github_gostaticanalysis_testutil-v0.5.0.zip", + "https://storage.googleapis.com/pingcapmirror/gomod/github.com/gostaticanalysis/testutil/com_github_gostaticanalysis_testutil-v0.5.0.zip", ], ) go_repository( @@ -5555,13 +5555,13 @@ def go_deps(): name = "com_github_otiai10_copy", build_file_proto_mode = "disable_global", importpath = "github.com/otiai10/copy", - sha256 = "479272f4510470d86cd2eeba8509dfb2265852b0387bb184650646badcef48f7", - strip_prefix = "github.com/otiai10/copy@v1.2.0", + sha256 = "a3712bae8f43c57bd9b4cfbc609ec52617c5aced3f89ca2f0e2bb055d127035d", + strip_prefix = "github.com/otiai10/copy@v1.14.0", urls = [ - "http://bazel-cache.pingcap.net:8080/gomod/github.com/otiai10/copy/com_github_otiai10_copy-v1.2.0.zip", - "http://ats.apps.svc/gomod/github.com/otiai10/copy/com_github_otiai10_copy-v1.2.0.zip", - "https://cache.hawkingrei.com/gomod/github.com/otiai10/copy/com_github_otiai10_copy-v1.2.0.zip", - "https://storage.googleapis.com/pingcapmirror/gomod/github.com/otiai10/copy/com_github_otiai10_copy-v1.2.0.zip", + "http://bazel-cache.pingcap.net:8080/gomod/github.com/otiai10/copy/com_github_otiai10_copy-v1.14.0.zip", + "http://ats.apps.svc/gomod/github.com/otiai10/copy/com_github_otiai10_copy-v1.14.0.zip", + "https://cache.hawkingrei.com/gomod/github.com/otiai10/copy/com_github_otiai10_copy-v1.14.0.zip", + "https://storage.googleapis.com/pingcapmirror/gomod/github.com/otiai10/copy/com_github_otiai10_copy-v1.14.0.zip", ], ) go_repository( @@ -5581,13 +5581,13 @@ def go_deps(): name = "com_github_otiai10_mint", build_file_proto_mode = "disable_global", importpath = "github.com/otiai10/mint", - sha256 = "564d4d726a29a48adeb9c03e3755fc85a8329b7ec82202a24e3320f10358ae47", - strip_prefix = "github.com/otiai10/mint@v1.3.1", + sha256 = "2fd679bb9287f3c035dfeb1200c80abce6a466138cc44471f708217ce4c5d13f", + strip_prefix = "github.com/otiai10/mint@v1.5.1", urls = [ - "http://bazel-cache.pingcap.net:8080/gomod/github.com/otiai10/mint/com_github_otiai10_mint-v1.3.1.zip", - "http://ats.apps.svc/gomod/github.com/otiai10/mint/com_github_otiai10_mint-v1.3.1.zip", - "https://cache.hawkingrei.com/gomod/github.com/otiai10/mint/com_github_otiai10_mint-v1.3.1.zip", - "https://storage.googleapis.com/pingcapmirror/gomod/github.com/otiai10/mint/com_github_otiai10_mint-v1.3.1.zip", + "http://bazel-cache.pingcap.net:8080/gomod/github.com/otiai10/mint/com_github_otiai10_mint-v1.5.1.zip", + "http://ats.apps.svc/gomod/github.com/otiai10/mint/com_github_otiai10_mint-v1.5.1.zip", + "https://cache.hawkingrei.com/gomod/github.com/otiai10/mint/com_github_otiai10_mint-v1.5.1.zip", + "https://storage.googleapis.com/pingcapmirror/gomod/github.com/otiai10/mint/com_github_otiai10_mint-v1.5.1.zip", ], ) go_repository( diff --git a/build/nogo_config.json b/build/nogo_config.json index 6104177c02410..d60d4c7197fbe 100644 --- a/build/nogo_config.json +++ b/build/nogo_config.json @@ -351,6 +351,7 @@ "pkg/parser/parser.go": "parser/parser.go code", "external/": "no need to vet third party code", ".*_generated\\.go$": "ignore generated code", + ".*_test\\.go$": "ignore test code", ".*mock.go$": "ignore generated code", "/cgo/": "no need to vet cgo code" }, diff --git a/go.mod b/go.mod index cbd5857652167..a78089919cf82 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/charithe/durationcheck v0.0.10 github.com/cheggaaa/pb/v3 v3.0.8 github.com/cheynewallace/tabby v1.1.1 - github.com/ckaznocha/intrange v0.2.1 + github.com/ckaznocha/intrange v0.3.0 github.com/cloudfoundry/gosigar v1.3.6 github.com/cockroachdb/pebble v1.1.0 github.com/coocood/freecache v1.2.1 @@ -81,7 +81,7 @@ require ( github.com/nishanths/predeclared v0.2.2 github.com/opentracing/basictracer-go v1.0.0 github.com/opentracing/opentracing-go v1.2.0 - github.com/otiai10/copy v1.2.0 + github.com/otiai10/copy v1.14.0 github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 github.com/pingcap/badger v1.5.1-0.20241015064302-38533b6cbf8d github.com/pingcap/errors v0.11.5-0.20240318064555-6bd07397691f diff --git a/go.sum b/go.sum index 8e481ecdb6392..32135fa32e589 100644 --- a/go.sum +++ b/go.sum @@ -162,8 +162,8 @@ github.com/cheynewallace/tabby v1.1.1/go.mod h1:Pba/6cUL8uYqvOc9RkyvFbHGrQ9wShyr github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/ckaznocha/intrange v0.2.1 h1:M07spnNEQoALOJhwrImSrJLaxwuiQK+hA2DeajBlwYk= -github.com/ckaznocha/intrange v0.2.1/go.mod h1:7NEhVyf8fzZO5Ds7CRaqPEm52Ut83hsTiL5zbER/HYk= +github.com/ckaznocha/intrange v0.3.0 h1:VqnxtK32pxgkhJgYQEeOArVidIPg+ahLP7WBOXZd5ZY= +github.com/ckaznocha/intrange v0.3.0/go.mod h1:+I/o2d2A1FBHgGELbGxzIcyd3/9l9DuwjM8FsbSS3Lo= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudfoundry/gosigar v1.3.6 h1:gIc08FbB3QPb+nAQhINIK/qhf5REKkY0FTGgRGXkcVc= github.com/cloudfoundry/gosigar v1.3.6/go.mod h1:lNWstu5g5gw59O09Y+wsMNFzBSnU8a0u+Sfx4dq360E= @@ -450,8 +450,8 @@ github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2 github.com/gostaticanalysis/forcetypeassert v0.1.0 h1:6eUflI3DiGusXGK6X7cCcIgVCpZ2CiZ1Q7jl6ZxNV70= github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= -github.com/gostaticanalysis/testutil v0.4.0 h1:nhdCmubdmDF6VEatUNjgUZBJKWRqugoISdUv3PPQgHY= -github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= +github.com/gostaticanalysis/testutil v0.5.0 h1:Dq4wT1DdTwTGCQQv3rl3IvD5Ld0E6HiY+3Zh0sUGqw8= +github.com/gostaticanalysis/testutil v0.5.0/go.mod h1:OLQSbuM6zw2EvCcXTz1lVq5unyoNft372msDY0nY5Hs= github.com/grafana/pyroscope-go v1.2.0 h1:aILLKjTj8CS8f/24OPMGPewQSYlhmdQMBmol1d3KGj8= github.com/grafana/pyroscope-go v1.2.0/go.mod h1:2GHr28Nr05bg2pElS+dDsc98f3JTUh2f6Fz1hWXrqwk= github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg= @@ -642,13 +642,15 @@ github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKw github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= -github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= +github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= +github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -github.com/otiai10/mint v1.3.1 h1:BCmzIS3n71sGfHB5NMNDB3lHYPz8fWSkCAErHed//qc= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= +github.com/otiai10/mint v1.5.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM= github.com/pborman/getopt v0.0.0-20180729010549-6fdd0a2c7117/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw= diff --git a/pkg/util/checksum/checksum_test.go b/pkg/util/checksum/checksum_test.go index 3391cec34c267..43013b3d59340 100644 --- a/pkg/util/checksum/checksum_test.go +++ b/pkg/util/checksum/checksum_test.go @@ -196,7 +196,7 @@ func testReadEmptyFile(t *testing.T, encrypt bool) { } } - for i := 0; i <= 10; i++ { + for i := range 11 { var underlying io.ReaderAt = f if encrypt { underlying = encrypt2.NewReader(underlying, ctrCipher) diff --git a/pkg/util/encrypt/crypt.go b/pkg/util/encrypt/crypt.go index 9fbf3b4f6a59c..6adbe11055bb1 100644 --- a/pkg/util/encrypt/crypt.go +++ b/pkg/util/encrypt/crypt.go @@ -70,18 +70,18 @@ type sqlCrypt struct { func (sc *sqlCrypt) init(password []byte, length int) { sc.rand.randomInit(password, length) - for i := 0; i <= 255; i++ { + for i := range 256 { sc.decodeBuff[i] = byte(i) } - for i := 0; i <= 255; i++ { + for i := range 256 { idx := uint32(sc.rand.myRand() * 255.0) a := sc.decodeBuff[idx] sc.decodeBuff[idx] = sc.decodeBuff[i] sc.decodeBuff[i] = a } - for i := 0; i <= 255; i++ { + for i := range 256 { sc.encodeBuff[sc.decodeBuff[i]] = byte(i) } diff --git a/pkg/util/extsort/disk_sorter_test.go b/pkg/util/extsort/disk_sorter_test.go index 8d13aa59c3ec7..7f3b38a71ba6b 100644 --- a/pkg/util/extsort/disk_sorter_test.go +++ b/pkg/util/extsort/disk_sorter_test.go @@ -398,7 +398,7 @@ func TestSSTReaderPoolParallel(t *testing.T) { pool := newSSTReaderPool(fs, dirname, cache) var wg sync.WaitGroup - for i := 0; i <= 16; i++ { + for i := range 17 { wg.Add(1) go func(fileNum int) { defer wg.Done()