mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
feat(options): panic when options are nil (#3363)
Client creation should panic when options are nil.
This commit is contained in:
@ -267,6 +267,10 @@ var (
|
||||
// a ClusterClient is returned.
|
||||
// 4. Otherwise, a single-node Client is returned.
|
||||
func NewUniversalClient(opts *UniversalOptions) UniversalClient {
|
||||
if opts == nil {
|
||||
panic("redis: NewUniversalClient nil options")
|
||||
}
|
||||
|
||||
switch {
|
||||
case opts.MasterName != "" && (opts.RouteByLatency || opts.RouteRandomly || opts.IsClusterMode):
|
||||
return NewFailoverClusterClient(opts.Failover())
|
||||
|
Reference in New Issue
Block a user