1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

chore: set the default value for the options.protocol in the init() of options (#3387)

* chore: set the default value for the `options.protocol` in the `init()` of `options`

Signed-off-by: fukua95 <fukua95@gmail.com>

* add a test

Signed-off-by: fukua95 <fukua95@gmail.com>

---------

Signed-off-by: fukua95 <fukua95@gmail.com>
This commit is contained in:
fukua95
2025-05-27 19:53:41 +08:00
committed by GitHub
parent 66b61c432c
commit 28a3c97409
3 changed files with 27 additions and 7 deletions

View File

@ -178,6 +178,9 @@ func (opt *Options) init() {
opt.Network = "tcp"
}
}
if opt.Protocol < 2 {
opt.Protocol = 3
}
if opt.DialTimeout == 0 {
opt.DialTimeout = 5 * time.Second
}