This is an automated email from the ASF dual-hosted git repository.

edwardxu pushed a commit to branch 2.13
in repository https://gitbox.apache.org/repos/asf/kvrocks.git

commit d80a1f73ed229b647b3a13aa9180b38b5ff90bb6
Author: Aleks Lozovyuk <[email protected]>
AuthorDate: Wed Jul 16 04:55:21 2025 +0300

    chore(ci): using golang-lint v2 (#3055)
---
 tests/gocase/.golangci.yml                   | 37 ++++++++++++++++++++++------
 tests/gocase/unit/type/bitmap/bitmap_test.go |  4 +--
 tests/gocase/unit/type/zset/zset_test.go     | 13 ++++++----
 tests/gocase/util/server.go                  |  2 +-
 x.py                                         |  2 +-
 5 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/tests/gocase/.golangci.yml b/tests/gocase/.golangci.yml
index eb6014735..1f34dbe31 100644
--- a/tests/gocase/.golangci.yml
+++ b/tests/gocase/.golangci.yml
@@ -15,28 +15,49 @@
 # specific language governing permissions and limitations
 # under the License.
 
+version: "2"
 run:
-  timeout: 10m
   concurrency: 4
   allow-parallel-runners: true
   allow-serial-runners: true
 linters:
-  disable-all: true
+  default: none
   enable:
     - asciicheck
     - bodyclose
+    - copyloopvar
     - durationcheck
     - errcheck
-    - copyloopvar
-    - gofmt
-    - goimports
-    - gosimple
     - ineffassign
     - makezero
     - prealloc
     - predeclared
     - rowserrcheck
     - staticcheck
-    - stylecheck
-    - typecheck
     - unused
+  exclusions:
+    generated: lax
+    presets:
+      - comments
+      - common-false-positives
+      - legacy
+      - std-error-handling
+    paths:
+      - third_party$
+      - builtin$
+      - examples$
+formatters:
+  enable:
+    - gofmt
+    - goimports
+  exclusions:
+    generated: lax
+    paths:
+      - third_party$
+      - builtin$
+      - examples$
+linters-settings:
+  staticcheck:
+    checks:
+      - all
+      - '-QF1012' # disable the rule QF1012: Use fmt.Fprintf(...) instead of 
WriteString(fmt.Sprintf(...))
\ No newline at end of file
diff --git a/tests/gocase/unit/type/bitmap/bitmap_test.go 
b/tests/gocase/unit/type/bitmap/bitmap_test.go
index 04012f791..6211ae3c8 100644
--- a/tests/gocase/unit/type/bitmap/bitmap_test.go
+++ b/tests/gocase/unit/type/bitmap/bitmap_test.go
@@ -48,7 +48,7 @@ const (
 func Set2SetBit(t *testing.T, rdb *redis.Client, ctx context.Context, key 
string, bs []byte) {
        buf := bytes.NewBuffer([]byte{})
        for _, v := range bs {
-               buf.WriteString(fmt.Sprintf("%08b", v))
+               _, _ = fmt.Fprintf(buf, "%08b", v)
        }
        for index, value := range buf.String() {
                require.NoError(t, rdb.SetBit(ctx, key, int64(index), 
int(value)-int('0')).Err())
@@ -74,7 +74,7 @@ func SimulateBitOp(op BITOP, values ...[]byte) string {
        for _, value := range values {
                buf := bytes.NewBuffer([]byte{})
                for _, v := range value {
-                       buf.WriteString(fmt.Sprintf("%08b", v))
+                       _, _ = fmt.Fprintf(buf, "%08b", v)
                }
                tmp := buf.String() + strings.Repeat("0", 
maxlen-len(buf.String()))
                binaryArray = append(binaryArray, tmp)
diff --git a/tests/gocase/unit/type/zset/zset_test.go 
b/tests/gocase/unit/type/zset/zset_test.go
index d4a7a83f9..774155a02 100644
--- a/tests/gocase/unit/type/zset/zset_test.go
+++ b/tests/gocase/unit/type/zset/zset_test.go
@@ -1661,13 +1661,16 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx 
context.Context, enabledRES
 
 func stressTests(t *testing.T, rdb *redis.Client, ctx context.Context, 
encoding string) {
        var elements int
-       if encoding == "ziplist" {
+       switch encoding {
+       case "ziplist":
                elements = 128
-       } else if encoding == "skiplist" {
+       case "skiplist":
                elements = 100
-       } else {
-               fmt.Println("Unknown sorted set encoding")
-               return
+       default:
+               {
+                       fmt.Println("Unknown sorted set encoding")
+                       return
+               }
        }
        t.Run(fmt.Sprintf("ZSCORE - %s", encoding), func(t *testing.T) {
                rdb.Del(ctx, "zscoretest")
diff --git a/tests/gocase/util/server.go b/tests/gocase/util/server.go
index 2e020c15e..ea8ee4742 100644
--- a/tests/gocase/util/server.go
+++ b/tests/gocase/util/server.go
@@ -244,7 +244,7 @@ func StartServerWithCLIOptions(
                defer func() { require.NoError(t, f.Close()) }()
 
                for k := range configs {
-                       _, err := f.WriteString(fmt.Sprintf("%s %s\n", k, 
configs[k]))
+                       _, err := fmt.Fprintf(f, "%s %s\n", k, configs[k])
                        require.NoError(t, err)
                }
                cmd.Args = append(cmd.Args, "-c", f.Name())
diff --git a/x.py b/x.py
index 9caf09f09..c7c690ec5 100755
--- a/x.py
+++ b/x.py
@@ -31,7 +31,7 @@ from shutil import which
 CMAKE_REQUIRE_VERSION = (3, 16, 0)
 CLANG_FORMAT_REQUIRED_VERSION = (12, 0, 0)
 CLANG_TIDY_REQUIRED_VERSION = (12, 0, 0)
-GOLANGCI_LINT_REQUIRED_VERSION = (1, 64, 3)
+GOLANGCI_LINT_REQUIRED_VERSION = (2, 2, 2)
 
 SEMVER_REGEX = re.compile(
     r"""

Reply via email to