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

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


The following commit(s) were added to refs/heads/unstable by this push:
     new 818d41980 chore(ci): bump golang lint to v2.9.0 (#3370)
818d41980 is described below

commit 818d4198013d4ef832265fcb650fe71afe941323
Author: Aleks Lozovyuk <[email protected]>
AuthorDate: Sun Feb 22 13:47:27 2026 +0200

    chore(ci): bump golang lint to v2.9.0 (#3370)
    
    Bump golang lint to v2.9.0 (see:
    https://golangci-lint.run/docs/product/changelog/#290)
    
    **Key changes**:
    
    - go1.26 support
    - Update linters, bug fix
    - Emit an error when no linters enabled
---
 tests/gocase/unit/config/config_test.go            |  2 +-
 tests/gocase/unit/server/poll_updates_test.go      |  2 +-
 tests/gocase/unit/type/hash/hash_test.go           | 36 +++++++++++-----------
 tests/gocase/unit/type/json/json_test.go           | 22 ++++++-------
 tests/gocase/unit/type/set/set_test.go             |  4 +--
 .../gocase/unit/type/timeseries/timeseries_test.go |  2 +-
 tests/gocase/unit/type/zset/zset_test.go           |  4 +--
 x.py                                               |  2 +-
 8 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/tests/gocase/unit/config/config_test.go 
b/tests/gocase/unit/config/config_test.go
index be3276c3c..1dcb4f8a5 100644
--- a/tests/gocase/unit/config/config_test.go
+++ b/tests/gocase/unit/config/config_test.go
@@ -55,7 +55,7 @@ func TestRenameCommand(t *testing.T) {
        require.Equal(t, []interface{}{}, rdb.Do(ctx, "KEYSNEW", "*").Val())
        require.NoError(t, rdb.Do(ctx, "SETNEW", "key", "1").Err())
        require.Equal(t, "1", rdb.Do(ctx, "GETNEW", "key").Val())
-       val := []string{}
+       val := make([]string, 0, 4)
        for _, v := range rdb.Do(ctx, "config", "get", 
"rename-command").Val().([]interface{}) {
                val = append(val, v.(string))
        }
diff --git a/tests/gocase/unit/server/poll_updates_test.go 
b/tests/gocase/unit/server/poll_updates_test.go
index e155bf00f..4d76499f9 100644
--- a/tests/gocase/unit/server/poll_updates_test.go
+++ b/tests/gocase/unit/server/poll_updates_test.go
@@ -126,7 +126,7 @@ func TestPollUpdates_Basic(t *testing.T) {
                        rdb0.Set(ctx, fmt.Sprintf("key-%d", i), i, 0)
                }
 
-               updates := make([]any, 0)
+               updates := make([]any, 0, 10)
                result, err := rdb0.Do(ctx, "POLLUPDATES", 0, "MAX", 6).Result()
                require.NoError(t, err)
                pollUpdates := parsePollUpdatesResult(t, 
result.(map[interface{}]interface{}), false)
diff --git a/tests/gocase/unit/type/hash/hash_test.go 
b/tests/gocase/unit/type/hash/hash_test.go
index eb568b257..1c972fa86 100644
--- a/tests/gocase/unit/type/hash/hash_test.go
+++ b/tests/gocase/unit/type/hash/hash_test.go
@@ -37,7 +37,7 @@ import (
 )
 
 func getKeys(hash map[string]string) []string {
-       r := make([]string, 0)
+       r := make([]string, 0, len(hash))
        for key := range hash {
                r = append(r, key)
        }
@@ -45,7 +45,7 @@ func getKeys(hash map[string]string) []string {
 }
 
 func getVals(hash map[string]string) []string {
-       r := make([]string, 0)
+       r := make([]string, 0, len(hash))
        for _, val := range hash {
                r = append(r, val)
        }
@@ -275,14 +275,14 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HGET against non existing key", func(t *testing.T) {
-               var rv []string
+               rv := make([]string, 0, 2)
                rv = append(rv, rdb.HGet(ctx, "samllhash", 
"__123123123__").Val())
                rv = append(rv, rdb.HGet(ctx, "bighash", "__123123123__").Val())
                require.Equal(t, []string{"", ""}, rv)
        })
 
        t.Run("HSET in update and insert mode", func(t *testing.T) {
-               var rv []string
+               rv := make([]string, 0, 8)
                k := getKeys(smallhash)[0]
                rv = append(rv, fmt.Sprintf("%d", rdb.HSet(ctx, "smallhash", k, 
"newval1").Val()))
                smallhash[k] = "newval1"
@@ -390,7 +390,7 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HMSET - small hash", func(t *testing.T) {
-               var args []string
+               args := make([]string, 0, 2*len(smallhash))
                for key := range smallhash {
                        newval := util.RandString(0, 8, util.Alpha)
                        smallhash[key] = newval
@@ -400,7 +400,7 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HMSET - big hash", func(t *testing.T) {
-               var args []string
+               args := make([]string, 0, 2*len(bighash))
                for key := range bighash {
                        newval := util.RandString(0, 8, util.Alpha)
                        bighash[key] = newval
@@ -410,7 +410,7 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HMGET against non existing key and fields", func(t *testing.T) {
-               var rv [][]interface{}
+               rv := make([][]interface{}, 0, 8)
                cmd1 := rdb.HMGet(ctx, "doesntexist", "__123123123__", 
"__456456456__")
                rv = append(rv, cmd1.Val())
                cmd2 := rdb.HMGet(ctx, "smallhash", "__123123123__", 
"__456456456__")
@@ -433,8 +433,8 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HMGET - small hash", func(t *testing.T) {
-               var keys []string
-               var vals []string
+               keys := make([]string, 0, len(smallhash))
+               vals := make([]string, 0, len(smallhash))
                for key, val := range smallhash {
                        keys = append(keys, key)
                        vals = append(vals, val)
@@ -451,8 +451,8 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HMGET - big hash", func(t *testing.T) {
-               var keys []string
-               var vals []string
+               keys := make([]string, 0, len(bighash))
+               vals := make([]string, 0, len(bighash))
                for key, val := range bighash {
                        keys = append(keys, key)
                        vals = append(vals, val)
@@ -537,7 +537,7 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HDEL and return value", func(t *testing.T) {
-               var rv []string
+               rv := make([]string, 0, 8)
                rv = append(rv, fmt.Sprintf("%d", rdb.HDel(ctx, "smallhash", 
"nokey").Val()))
                rv = append(rv, fmt.Sprintf("%d", rdb.HDel(ctx, "bighash", 
"nokey").Val()))
                k := getKeys(smallhash)[0]
@@ -569,7 +569,7 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HEXISTS", func(t *testing.T) {
-               var rv []bool
+               rv := make([]bool, 0, 4)
                k := getKeys(smallhash)[0]
                rv = append(rv, rdb.HExists(ctx, "smallhash", k).Val())
                rv = append(rv, rdb.HExists(ctx, "smallhash", "nokey").Val())
@@ -585,7 +585,7 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HINCRBY against non existing hash key", func(t *testing.T) {
-               var rv []string
+               rv := make([]string, 0, 4)
                rdb.HDel(ctx, "smallhash", "tmp")
                rdb.HDel(ctx, "bighash", "tmp")
                rv = append(rv, fmt.Sprintf("%d", rdb.HIncrBy(ctx, "smallhash", 
"tmp", 2).Val()))
@@ -596,7 +596,7 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HINCRBY against hash key created by hincrby itself", func(t 
*testing.T) {
-               var rv []string
+               rv := make([]string, 0, 4)
                rv = append(rv, fmt.Sprintf("%d", rdb.HIncrBy(ctx, "smallhash", 
"tmp", 3).Val()))
                rv = append(rv, rdb.HGet(ctx, "smallhash", "tmp").Val())
                rv = append(rv, fmt.Sprintf("%d", rdb.HIncrBy(ctx, "bighash", 
"tmp", 3).Val()))
@@ -685,7 +685,7 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HINCRBYFLOAT against hash key originally set with HSET", func(t 
*testing.T) {
-               var rv []float64
+               rv := make([]float64, 0, 2)
                rdb.HSet(ctx, "smallhash", "tmp", 100)
                rdb.HSet(ctx, "bighash", "tmp", 100)
                rv = append(rv, rdb.HIncrByFloat(ctx, "smallhash", "tmp", 
2.5).Val())
@@ -750,7 +750,7 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("HSTRLEN against non existing field", func(t *testing.T) {
-               var rv []int64
+               rv := make([]int64, 0, 2)
                rv = append(rv, rdb.Do(ctx, "hstrlen", "smallhash", 
"__123123123__").Val().(int64))
                rv = append(rv, rdb.Do(ctx, "hstrlen", "bighash", 
"__123123123__").Val().(int64))
                require.Equal(t, []int64{0, 0}, rv)
@@ -960,7 +960,7 @@ var testHash = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
                        result, err = rdb.HRandField(ctx, "nonexistent-key", 
1).Result()
                        require.NoError(t, err)
                        require.Len(t, result, 0)
-                       var rv [][]interface{}
+                       rv := make([][]interface{}, 0, 6)
                        resultWithValues, err := rdb.HRandFieldWithValues(ctx, 
testKey, 5).Result()
                        require.NoError(t, err)
                        require.Len(t, resultWithValues, 3)
diff --git a/tests/gocase/unit/type/json/json_test.go 
b/tests/gocase/unit/type/json/json_test.go
index 88673d10b..a233aaf97 100644
--- a/tests/gocase/unit/type/json/json_test.go
+++ b/tests/gocase/unit/type/json/json_test.go
@@ -175,24 +175,24 @@ func testJSON(t *testing.T, configs 
util.KvrocksServerConfigs) {
        })
 
        t.Run("JSON.STRAPPEND basics", func(t *testing.T) {
-               var result1 = make([]interface{}, 0)
+               var result1 = make([]interface{}, 0, 1)
                result1 = append(result1, int64(5))
                require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", 
`{"a":"foo", "nested": {"a": "hello"}, "nested2": {"a": 31}}`).Err())
                require.Equal(t, rdb.Do(ctx, "JSON.STRAPPEND", "a", "$.a", 
"\"be\"").Val(), result1)
 
-               var result2 = make([]interface{}, 0)
+               var result2 = make([]interface{}, 0, 3)
                result2 = append(result2, int64(5), int64(7), interface{}(nil))
                require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", 
`{"a":"foo", "nested": {"a": "hello"}, "nested2": {"a": 31}}`).Err())
                require.Equal(t, rdb.Do(ctx, "JSON.STRAPPEND", "a", "$..a", 
"\"be\"").Val(), result2)
        })
 
        t.Run("JSON.STRLEN basics", func(t *testing.T) {
-               var result1 = make([]interface{}, 0)
+               var result1 = make([]interface{}, 0, 1)
                result1 = append(result1, int64(3))
                require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", 
`{"a":"foo", "nested": {"a": "hello"}, "nested2": {"a": 31}}`).Err())
                require.Equal(t, rdb.Do(ctx, "JSON.STRLEN", "a", "$.a").Val(), 
result1)
 
-               var result2 = make([]interface{}, 0)
+               var result2 = make([]interface{}, 0, 3)
                result2 = append(result2, int64(3), int64(5), interface{}(nil))
                require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", 
`{"a":"foo", "nested": {"a": "hello"}, "nested2": {"a": 31}}`).Err())
                require.Equal(t, rdb.Do(ctx, "JSON.STRLEN", "a", "$..a").Val(), 
result2)
@@ -685,15 +685,15 @@ func testJSON(t *testing.T, configs 
util.KvrocksServerConfigs) {
        t.Run("JSON.DEBUG MEMORY basics", func(t *testing.T) {
                require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", 
`{"b":true,"x":1, "y":1.2, "z": {"x":[1,2,3], "y": null}, 
"v":{"x":"y"},"f":{"x":[]}}`).Err())
                //object
-               var result1 = make([]interface{}, 0)
+               var result1 = make([]interface{}, 0, 1)
                result1 = append(result1, int64(43))
                require.Equal(t, result1, rdb.Do(ctx, "JSON.DEBUG", "MEMORY", 
"a", "$").Val())
                //integer string array empty_array
-               var result2 = make([]interface{}, 0)
+               var result2 = make([]interface{}, 0, 4)
                result2 = append(result2, int64(1), int64(1), int64(2), 
int64(4))
                require.Equal(t, result2, rdb.Do(ctx, "JSON.DEBUG", "MEMORY", 
"a", "$..x").Val())
                //null object
-               var result3 = make([]interface{}, 0)
+               var result3 = make([]interface{}, 0, 2)
                result3 = append(result3, int64(9), int64(1))
                require.Equal(t, result3, rdb.Do(ctx, "JSON.DEBUG", "MEMORY", 
"a", "$..y").Val())
                //no no_exists
@@ -708,10 +708,10 @@ func testJSON(t *testing.T, configs 
util.KvrocksServerConfigs) {
        t.Run("JSON.RESP basics", func(t *testing.T) {
                require.NoError(t, rdb.Do(ctx, "JSON.SET", "item:2", "$", 
`{"name":"Wireless earbuds","description":"Wireless Bluetooth in-ear 
headphones","connection":{"wireless":true,"type":"null"},"price":64.99,"stock":17,"colors":[null,"white"],
 "max_level":[80, 100, 120]}`).Err())
                //array object null both  have
-               var result = make([]interface{}, 0)
-               var resultarray1 = make([]interface{}, 0)
-               var resultobject1 = make([]interface{}, 0)
-               var resultarray2 = make([]interface{}, 0)
+               var result = make([]interface{}, 0, 16)
+               var resultarray1 = make([]interface{}, 0, 4)
+               var resultobject1 = make([]interface{}, 0, 8)
+               var resultarray2 = make([]interface{}, 0, 4)
                resultobject1 = append(resultobject1, "{", "type", "null", 
"wireless", "true")
                resultarray1 = append(resultarray1, "[", nil, "white")
                resultarray2 = append(resultarray2, "[", int64(80), int64(100), 
int64(120))
diff --git a/tests/gocase/unit/type/set/set_test.go 
b/tests/gocase/unit/type/set/set_test.go
index 3c910513f..bb20d4b55 100644
--- a/tests/gocase/unit/type/set/set_test.go
+++ b/tests/gocase/unit/type/set/set_test.go
@@ -562,7 +562,7 @@ var setTests = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
 
        t.Run("SPOP with <count> hashtable", func(t *testing.T) {
                CreateSet(t, rdb, ctx, "myset", []interface{}{"a", "b", "c", 
"d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", 
"t", "u", "v", "w", "x", "y", "z"})
-               var array []string
+               array := make([]string, 0, 8)
                var popNum = []int64{11, 9, 0, 4, 1, 0, 1, 9}
                for _, i := range popNum {
                        cmd := rdb.SPopN(ctx, "myset", i)
@@ -576,7 +576,7 @@ var setTests = func(t *testing.T, configs 
util.KvrocksServerConfigs) {
 
        t.Run("SPOP with <count> intset", func(t *testing.T) {
                CreateSet(t, rdb, ctx, "myset", []interface{}{1, 10, 11, 12, 
13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22, 23, 24, 25, 26, 3, 4, 5, 6, 7, 8, 9})
-               var array []string
+               array := make([]string, 0, 8)
                var popNum = []int64{11, 9, 0, 4, 1, 0, 1, 9}
                for _, i := range popNum {
                        cmd := rdb.SPopN(ctx, "myset", i)
diff --git a/tests/gocase/unit/type/timeseries/timeseries_test.go 
b/tests/gocase/unit/type/timeseries/timeseries_test.go
index b0d9a1936..a4763c099 100644
--- a/tests/gocase/unit/type/timeseries/timeseries_test.go
+++ b/tests/gocase/unit/type/timeseries/timeseries_test.go
@@ -670,7 +670,7 @@ func testTimeSeries(t *testing.T, configs 
util.KvrocksServerConfigs) {
                        resultArray, ok := result.([]interface{})
                        require.True(t, ok, "Expected array result")
 
-                       foundKeys := make([]string, 0)
+                       foundKeys := make([]string, 0, len(resultArray))
                        for _, item := range resultArray {
                                itemArray, ok := item.([]interface{})
                                require.True(t, ok, "Expected item to be an 
array")
diff --git a/tests/gocase/unit/type/zset/zset_test.go 
b/tests/gocase/unit/type/zset/zset_test.go
index aea45de83..9d3e125fa 100644
--- a/tests/gocase/unit/type/zset/zset_test.go
+++ b/tests/gocase/unit/type/zset/zset_test.go
@@ -1697,7 +1697,7 @@ func stressTests(t *testing.T, rdb *redis.Client, ctx 
context.Context, encoding
                delta := 0
                for test := 0; test < 2; test++ {
                        auxArray := make(map[string]float64)
-                       auxList := make([]redis.Z, 0)
+                       auxList := make([]redis.Z, 0, 4)
                        rdb.Del(ctx, "myzset")
                        var score float64
                        for i := 0; i < elements; i++ {
@@ -1736,7 +1736,7 @@ func stressTests(t *testing.T, rdb *redis.Client, ctx 
context.Context, encoding
                                        }
                                }
                        })
-                       var aux []string
+                       aux := make([]string, 0, len(auxList))
                        for _, z := range auxList {
                                aux = append(aux, z.Member.(string))
                        }
diff --git a/x.py b/x.py
index 559d7eecf..ee28fea38 100755
--- a/x.py
+++ b/x.py
@@ -32,7 +32,7 @@ from tempfile import TemporaryDirectory
 CMAKE_REQUIRE_VERSION = (3, 16, 0)
 CLANG_FORMAT_REQUIRED_VERSION = (18, 0, 0)
 CLANG_TIDY_REQUIRED_VERSION = (18, 0, 0)
-GOLANGCI_LINT_REQUIRED_VERSION = (2, 7, 0)
+GOLANGCI_LINT_REQUIRED_VERSION = (2, 9, 0)
 
 SEMVER_REGEX = re.compile(
     r"""

Reply via email to