From ca239f0353faacde1a22543b62b35ace7a66a583 Mon Sep 17 00:00:00 2001 From: Juan Calderon-Perez Date: Sat, 8 Apr 2023 18:41:29 -0700 Subject: [PATCH] Fix syntax issues --- redis/redis.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/redis/redis.go b/redis/redis.go index d8d53070..a32866ef 100644 --- a/redis/redis.go +++ b/redis/redis.go @@ -19,11 +19,8 @@ func New(config ...Config) *Storage { cfg := configDefault(config...) // Create new redis client - var options *redis.Options - var err error - if cfg.URL != "" && !cfg.EnableFailover { - options, err = redis.ParseURL(cfg.URL) + options, err := redis.ParseURL(cfg.URL) if err != nil { panic(err) @@ -31,9 +28,9 @@ func New(config ...Config) *Storage { options.TLSConfig = cfg.TLSConfig options.PoolSize = cfg.PoolSize - db = redis.NewClient(options) + db := redis.NewClient(options) } else if cfg.EnableFailover { - options = &redis.FailoverOptions{ + options := &redis.FailoverOptions{ MasterName: cfg.MasterName, SentinelAddrs: cfg.SentinelHosts, ClientName: cfg.ClientName, @@ -44,9 +41,9 @@ func New(config ...Config) *Storage { TLSConfig: cfg.TLSConfig, PoolSize: cfg.PoolSize, } - db = redis.NewFailoverClient(options) + db := redis.NewFailoverClient(options) } else { - options = &redis.Options{ + options := &redis.Options{ Addr: fmt.Sprintf("%s:%d", cfg.Host, cfg.Port), DB: cfg.Database, Username: cfg.Username,