fix(build): repoint go-redis internal imports to hanzoai/kv-go module path and restore lost merge artifacts (internal/rand->math/rand, pool close-reason/metric-state consts, otel/push/util/auth/uberatomic imports)

Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
2026-06-30 16:15:55 -07:00
co-authored by Hanzo Dev
parent 7d745d140c
commit e3ee0b50f2
37 changed files with 78 additions and 50 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ import (
. "github.com/bsm/ginkgo/v2"
. "github.com/bsm/gomega"
"github.com/redis/go-redis/v9"
"github.com/hanzoai/kv-go/v9"
)
var _ = Describe("Array Commands", Label("array"), func() {
+1 -1
View File
@@ -3,7 +3,7 @@ package redis
import (
"time"
"github.com/redis/go-redis/v9/internal"
"github.com/hanzoai/kv-go/v9/internal"
)
// DialRetryBackoffConstant returns a dial retry backoff function that always returns d.
+1 -1
View File
@@ -7,7 +7,7 @@ import (
. "github.com/bsm/ginkgo/v2"
. "github.com/bsm/gomega"
"github.com/redis/go-redis/v9"
"github.com/hanzoai/kv-go/v9"
)
var _ = Describe("HotKeys Commands", func() {
-2
View File
@@ -3,8 +3,6 @@ package hashtag
import (
"math/rand"
"strings"
"github.com/hanzoai/kv-go/v9/internal/rand"
)
const slotNumber = 16384
-2
View File
@@ -5,8 +5,6 @@ import (
. "github.com/bsm/ginkgo/v2"
. "github.com/bsm/gomega"
"github.com/hanzoai/kv-go/v9/internal/rand"
)
func TestGinkgoSuite(t *testing.T) {
-2
View File
@@ -3,8 +3,6 @@ package internal
import (
"math/rand"
"time"
"github.com/hanzoai/kv-go/v9/internal/rand"
)
func RetryBackoff(retry int, minBackoff, maxBackoff time.Duration) time.Duration {
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"sync"
"time"
"github.com/redis/go-redis/v9/internal/pool"
"github.com/hanzoai/kv-go/v9/internal/pool"
)
// generateUniqueID generates a short unique identifier for pool names.
+1
View File
@@ -14,6 +14,7 @@ import (
"github.com/hanzoai/kv-go/v9/internal"
"github.com/hanzoai/kv-go/v9/internal/maintnotifications/logs"
"github.com/hanzoai/kv-go/v9/internal/proto"
uberatomic "go.uber.org/atomic"
)
var noDeadline = time.Time{}
+35 -1
View File
@@ -11,7 +11,41 @@ import (
"github.com/hanzoai/kv-go/v9/internal"
"github.com/hanzoai/kv-go/v9/internal/proto"
"github.com/hanzoai/kv-go/v9/internal/rand"
)
// Connection close reason constants for metrics.
// These are used as the "reason" parameter in CloseConn() calls.
const (
// CloseReasonStale indicates the connection was closed because it exceeded
// the idle timeout or max lifetime.
CloseReasonStale = "stale"
// CloseReasonHookError indicates the connection was closed due to an error
// in a pool hook (OnGet or OnPut).
CloseReasonHookError = "hook_error"
// CloseReasonAuthError indicates the connection was closed due to an
// authentication error during re-authentication.
CloseReasonAuthError = "auth_error"
// CloseReasonTest is used in tests when closing connections.
CloseReasonTest = "test"
// CloseReasonFailover indicates the connection was closed due to a failover event.
CloseReasonFailover = "failover"
)
// Metric state constants for connection state tracking.
// These represent the logical state of a connection from a metrics perspective,
// not the internal state machine state (ConnState).
const (
// MetricStateIdle indicates the connection is idle in the pool,
// ready to be acquired.
MetricStateIdle = "idle"
// MetricStateUsed indicates the connection is currently being used
// by a client operation.
MetricStateUsed = "used"
)
var (
+2 -4
View File
@@ -12,8 +12,8 @@ import (
"testing"
"time"
"github.com/redis/go-redis/v9/internal/pool"
"github.com/redis/go-redis/v9/maintnotifications"
"github.com/hanzoai/kv-go/v9/internal/pool"
"github.com/hanzoai/kv-go/v9/maintnotifications"
)
// TestInitConnNilMaintNotificationsConfig is a regression test for
@@ -100,7 +100,6 @@ func TestInitConnNilMaintNotificationsConfig(t *testing.T) {
_ = c.initConn(context.Background(), cn)
}
// mockRESP2Server is a minimal RESP server used to exercise the HELLO
// fallback path in initConn. It replies with a Redis protocol error to
// HELLO (simulating a server that only speaks RESP2) and with +OK to every
@@ -211,7 +210,6 @@ func startMockRESP2Server(t *testing.T) *mockRESP2Server {
return s
}
// assertNoMaintNotifications fails the test if a CLIENT MAINT_NOTIFICATIONS
// command was observed by srv.
func assertNoMaintNotifications(t *testing.T, srv *mockRESP2Server) {
+1 -1
View File
@@ -11,6 +11,7 @@ import (
"testing"
"time"
"github.com/hanzoai/kv-go/v9/auth"
"github.com/hanzoai/kv-go/v9/internal/pool"
"github.com/hanzoai/kv-go/v9/internal/proto"
@@ -1181,4 +1182,3 @@ func TestPubSubConn_PassesPersistedChannelsToNewConn(t *testing.T) {
})
}
}
@@ -8,9 +8,9 @@ import (
"testing"
"time"
"github.com/redis/go-redis/v9"
"github.com/redis/go-redis/v9/logging"
"github.com/redis/go-redis/v9/maintnotifications"
"github.com/hanzoai/kv-go/v9"
"github.com/hanzoai/kv-go/v9/logging"
"github.com/hanzoai/kv-go/v9/maintnotifications"
)
// startBackgroundTraffic starts a background goroutine that continuously sends commands
@@ -7,7 +7,7 @@ import (
"os/signal"
"syscall"
e2e "github.com/redis/go-redis/v9/maintnotifications/e2e"
e2e "github.com/hanzoai/kv-go/v9/maintnotifications/e2e"
)
func main() {
@@ -9,8 +9,8 @@ import (
"testing"
"time"
"github.com/redis/go-redis/v9"
"github.com/redis/go-redis/v9/maintnotifications"
"github.com/hanzoai/kv-go/v9"
"github.com/hanzoai/kv-go/v9/maintnotifications"
)
// TestUnifiedInjector_SMIGRATING demonstrates using the unified notification injector
@@ -6,8 +6,8 @@ import (
"testing"
"time"
"github.com/redis/go-redis/v9/internal/interfaces"
"github.com/redis/go-redis/v9/push"
"github.com/hanzoai/kv-go/v9/internal/interfaces"
"github.com/hanzoai/kv-go/v9/push"
)
// testOptions implements interfaces.OptionsInterface for testing SMIGRATED
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"testing"
"time"
"github.com/redis/go-redis/v9/maintnotifications"
"github.com/hanzoai/kv-go/v9/maintnotifications"
)
func TestParseURL(t *testing.T) {
+1 -1
View File
@@ -21,9 +21,9 @@ import (
"github.com/hanzoai/kv-go/v9/auth"
"github.com/hanzoai/kv-go/v9/internal"
"github.com/hanzoai/kv-go/v9/internal/hashtag"
"github.com/hanzoai/kv-go/v9/internal/otel"
"github.com/hanzoai/kv-go/v9/internal/pool"
"github.com/hanzoai/kv-go/v9/internal/proto"
"github.com/hanzoai/kv-go/v9/internal/rand"
"github.com/hanzoai/kv-go/v9/internal/routing"
"github.com/hanzoai/kv-go/v9/maintnotifications"
"github.com/hanzoai/kv-go/v9/push"
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"testing"
"time"
"github.com/redis/go-redis/v9"
"github.com/hanzoai/kv-go/v9"
)
// multiNodeProxy represents a cae-resp-proxy instance that can mimic multiple cluster nodes
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"testing"
"time"
"github.com/redis/go-redis/v9"
"github.com/redis/go-redis/v9/maintnotifications"
"github.com/hanzoai/kv-go/v9"
"github.com/hanzoai/kv-go/v9/maintnotifications"
)
// TestClusterMaintNotifications_CallbackSetup tests that the cluster state reload callback is properly set up
+2 -2
View File
@@ -5,8 +5,8 @@ import (
"net"
"time"
"github.com/redis/go-redis/v9/internal/otel"
"github.com/redis/go-redis/v9/internal/pool"
"github.com/hanzoai/kv-go/v9/internal/otel"
"github.com/hanzoai/kv-go/v9/internal/pool"
)
// ConnInfo provides information about a Redis connection for metrics.
+1
View File
@@ -10,6 +10,7 @@ import (
"time"
"github.com/hanzoai/kv-go/v9/internal"
"github.com/hanzoai/kv-go/v9/internal/otel"
"github.com/hanzoai/kv-go/v9/internal/pool"
"github.com/hanzoai/kv-go/v9/internal/proto"
"github.com/hanzoai/kv-go/v9/push"
+1 -1
View File
@@ -3,7 +3,7 @@ package redis
import (
"context"
"github.com/redis/go-redis/v9/internal/otel"
"github.com/hanzoai/kv-go/v9/internal/otel"
)
type PubSubCmdable interface {
+1
View File
@@ -13,6 +13,7 @@ import (
"github.com/hanzoai/kv-go/v9/internal"
"github.com/hanzoai/kv-go/v9/internal/auth/streaming"
"github.com/hanzoai/kv-go/v9/internal/hscan"
"github.com/hanzoai/kv-go/v9/internal/otel"
"github.com/hanzoai/kv-go/v9/internal/pool"
"github.com/hanzoai/kv-go/v9/internal/proto"
"github.com/hanzoai/kv-go/v9/maintnotifications"
-3
View File
@@ -12,15 +12,12 @@ import (
"sync/atomic"
"time"
"github.com/cespare/xxhash/v2"
"github.com/dgryski/go-rendezvous" //nolint
"github.com/hanzoai/kv-go/v9/auth"
"github.com/hanzoai/kv-go/v9/internal"
"github.com/hanzoai/kv-go/v9/internal/hashtag"
"github.com/hanzoai/kv-go/v9/internal/pool"
"github.com/hanzoai/kv-go/v9/internal/proto"
"github.com/hanzoai/kv-go/v9/internal/rand"
)
var errRingShardsDown = errors.New("redis: all ring shards are down")
+1 -1
View File
@@ -3,7 +3,7 @@ package redis_test
import (
. "github.com/bsm/ginkgo/v2"
. "github.com/bsm/gomega"
"github.com/redis/go-redis/v9"
"github.com/hanzoai/kv-go/v9"
)
var _ = Describe("NewScriptServerSHA", func() {
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"sync"
"testing"
"github.com/redis/go-redis/v9/internal/proto"
"github.com/hanzoai/kv-go/v9/internal/proto"
)
// fakeScripter simulates enough of Scripter for unit testing Script behavior.
+5 -5
View File
@@ -4,7 +4,7 @@ import (
"context"
"testing"
"github.com/redis/go-redis/v9"
"github.com/hanzoai/kv-go/v9"
)
// TestSearchCommandsRESP2AndRESP3Equivalence tests that search commands
@@ -118,9 +118,9 @@ func TestSearchCommandsRESP2AndRESP3Equivalence(t *testing.T) {
// the data is silently lost. Assert both that the RESP3 value is
// non-empty and that it matches the RESP2 value.
avgFields := []struct {
name string
resp2Val string
resp3Val string
name string
resp2Val string
resp3Val string
}{
{"BytesPerRecordAvg", info2.BytesPerRecordAvg, info3.BytesPerRecordAvg},
{"RecordsPerDocAvg", info2.RecordsPerDocAvg, info3.RecordsPerDocAvg},
@@ -148,7 +148,7 @@ func TestSearchCommandsRESP2AndRESP3Equivalence(t *testing.T) {
// (see src/fork_gc/fork_gc.c statsCb) but typed as int in GCStats.
// Compare each individually so a regression surfaces with a precise message.
gcFields := []struct {
name string
name string
resp2, resp3 int
}{
{"BytesCollected", info2.GCStats.BytesCollected, info3.GCStats.BytesCollected},
-1
View File
@@ -17,7 +17,6 @@ import (
"github.com/hanzoai/kv-go/v9/auth"
"github.com/hanzoai/kv-go/v9/internal"
"github.com/hanzoai/kv-go/v9/internal/pool"
"github.com/hanzoai/kv-go/v9/internal/rand"
"github.com/hanzoai/kv-go/v9/maintnotifications"
"github.com/hanzoai/kv-go/v9/push"
)
+1
View File
@@ -16,6 +16,7 @@ import (
. "github.com/bsm/ginkgo/v2"
. "github.com/bsm/gomega"
"github.com/hanzoai/kv-go/v9"
"github.com/hanzoai/kv-go/v9/internal/pool"
)
var _ = Describe("Sentinel PROTO 2", func() {
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"strings"
"time"
"github.com/redis/go-redis/v9/internal/otel"
"github.com/hanzoai/kv-go/v9/internal/otel"
)
type StreamCmdable interface {
+1
View File
@@ -7,6 +7,7 @@ import (
"strings"
"github.com/hanzoai/kv-go/v9/internal/proto"
"github.com/hanzoai/kv-go/v9/internal/util"
)
type TimeseriesCmdable interface {
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"strings"
"testing"
"github.com/redis/go-redis/v9"
"github.com/hanzoai/kv-go/v9"
)
func init() {
+1 -1
View File
@@ -9,7 +9,7 @@ import (
. "github.com/bsm/ginkgo/v2"
. "github.com/bsm/gomega"
"github.com/redis/go-redis/v9"
"github.com/hanzoai/kv-go/v9"
)
var _ = Describe("TLS Cluster", Label("NonRedisEnterprise"), func() {
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"crypto/tls"
"testing"
"github.com/redis/go-redis/v9"
"github.com/hanzoai/kv-go/v9"
)
// TestTLSStandalone tests TLS connection to standalone Redis
+1 -1
View File
@@ -9,7 +9,7 @@ import (
. "github.com/bsm/ginkgo/v2"
. "github.com/bsm/gomega"
"github.com/redis/go-redis/v9"
"github.com/hanzoai/kv-go/v9"
)
// loadTLSConfig loads TLS certificates from the docker test environment
+1
View File
@@ -8,6 +8,7 @@ import (
"github.com/hanzoai/kv-go/v9/auth"
"github.com/hanzoai/kv-go/v9/maintnotifications"
"github.com/hanzoai/kv-go/v9/push"
)
// UniversalOptions information is required by UniversalClient to establish
+2 -2
View File
@@ -8,7 +8,7 @@ import (
"strings"
"testing"
"github.com/redis/go-redis/v9/internal/proto"
"github.com/hanzoai/kv-go/v9/internal/proto"
)
func TestVectorFP32_Value(t *testing.T) {
@@ -761,7 +761,7 @@ func TestVIsMember(t *testing.T) {
cmd := m.lastCmd.(*BoolCmd)
if cmd.args[0] != "vismember" || cmd.args[1] != "k" || cmd.args[2] != "e" {
t.Errorf("unexpected args: %v", cmd.args)
}
}
}
// TestVectorScoreSliceCmdReadReply tests that VectorScoreSliceCmd.readReply handles