From 512e6c7a400e9fc5daaa7195ae9d25824823dacf Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Wed, 12 Feb 2020 13:02:09 +0200 Subject: [PATCH] Unexport Clone and Lock from embedded hooks --- cluster.go | 2 +- redis.go | 8 ++++---- ring.go | 2 +- tx.go | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cluster.go b/cluster.go index ac35ea79..c5fcb9bb 100644 --- a/cluster.go +++ b/cluster.go @@ -696,7 +696,7 @@ func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient { } clone := *c clone.cmdable = clone.Process - clone.hooks.Lock() + clone.hooks.lock() clone.ctx = ctx return &clone } diff --git a/redis.go b/redis.go index 9cdff78a..2b50fff0 100644 --- a/redis.go +++ b/redis.go @@ -32,13 +32,13 @@ type hooks struct { hooks []Hook } -func (hs *hooks) Lock() { +func (hs *hooks) lock() { hs.hooks = hs.hooks[:len(hs.hooks):len(hs.hooks)] } -func (hs hooks) Clone() hooks { +func (hs hooks) clone() hooks { clone := hs - clone.Lock() + clone.lock() return clone } @@ -526,7 +526,7 @@ func NewClient(opt *Options) *Client { func (c *Client) clone() *Client { clone := *c clone.cmdable = clone.Process - clone.hooks.Lock() + clone.hooks.lock() return &clone } diff --git a/ring.go b/ring.go index 0fac5760..b0c6dfc3 100644 --- a/ring.go +++ b/ring.go @@ -407,7 +407,7 @@ func (c *Ring) WithContext(ctx context.Context) *Ring { } clone := *c clone.cmdable = clone.Process - clone.hooks.Lock() + clone.hooks.lock() clone.ctx = ctx return &clone } diff --git a/tx.go b/tx.go index fd89a7e6..aef18ab5 100644 --- a/tx.go +++ b/tx.go @@ -28,7 +28,7 @@ func (c *Client) newTx(ctx context.Context) *Tx { opt: c.opt, connPool: pool.NewStickyConnPool(c.connPool.(*pool.ConnPool), true), }, - hooks: c.hooks.Clone(), + hooks: c.hooks.clone(), ctx: ctx, } tx.init() @@ -50,7 +50,7 @@ func (c *Tx) WithContext(ctx context.Context) *Tx { } clone := *c clone.init() - clone.hooks.Lock() + clone.hooks.lock() clone.ctx = ctx return &clone }