Skip to content

Commit 709e543

Browse files
authored
Merge pull request #1259 from go-redis/fix/unexport-lock-clone
Unexport Clone and Lock from embedded hooks
2 parents 6bd8d9c + 512e6c7 commit 709e543

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient {
696696
}
697697
clone := *c
698698
clone.cmdable = clone.Process
699-
clone.hooks.Lock()
699+
clone.hooks.lock()
700700
clone.ctx = ctx
701701
return &clone
702702
}

redis.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ type hooks struct {
3232
hooks []Hook
3333
}
3434

35-
func (hs *hooks) Lock() {
35+
func (hs *hooks) lock() {
3636
hs.hooks = hs.hooks[:len(hs.hooks):len(hs.hooks)]
3737
}
3838

39-
func (hs hooks) Clone() hooks {
39+
func (hs hooks) clone() hooks {
4040
clone := hs
41-
clone.Lock()
41+
clone.lock()
4242
return clone
4343
}
4444

@@ -526,7 +526,7 @@ func NewClient(opt *Options) *Client {
526526
func (c *Client) clone() *Client {
527527
clone := *c
528528
clone.cmdable = clone.Process
529-
clone.hooks.Lock()
529+
clone.hooks.lock()
530530
return &clone
531531
}
532532

ring.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ func (c *Ring) WithContext(ctx context.Context) *Ring {
407407
}
408408
clone := *c
409409
clone.cmdable = clone.Process
410-
clone.hooks.Lock()
410+
clone.hooks.lock()
411411
clone.ctx = ctx
412412
return &clone
413413
}

tx.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (c *Client) newTx(ctx context.Context) *Tx {
2828
opt: c.opt,
2929
connPool: pool.NewStickyConnPool(c.connPool.(*pool.ConnPool), true),
3030
},
31-
hooks: c.hooks.Clone(),
31+
hooks: c.hooks.clone(),
3232
ctx: ctx,
3333
}
3434
tx.init()
@@ -50,7 +50,7 @@ func (c *Tx) WithContext(ctx context.Context) *Tx {
5050
}
5151
clone := *c
5252
clone.init()
53-
clone.hooks.Lock()
53+
clone.hooks.lock()
5454
clone.ctx = ctx
5555
return &clone
5656
}

0 commit comments

Comments
 (0)