1
0
mirror of https://github.com/redis/go-redis.git synced 2025-09-11 18:10:43 +03:00

chore(doc): improve code readability (#3446)

- replace two similar functions `appendUniqueNode` and `appendIfNotExists` with a generic function.

- simplify the implementation of the `get` method in `clusterNodes`

- keep the member name `_generation` of `clusterNodes` consistent with other types.

- rename a data member `_masterAddr` to `masterAddr`.

Signed-off-by: Xiaolong Chen <fukua95@gmail.com>
This commit is contained in:
cxljs
2025-08-04 22:22:16 +08:00
committed by ofekshenawa
parent 6f1aac4aa3
commit bbadd655ed
3 changed files with 29 additions and 47 deletions

View File

@@ -383,7 +383,7 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
// for redis-server versions that do not support the HELLO command,
// RESP2 will continue to be used.
if err = conn.Hello(ctx, c.opt.Protocol, username, password, c.opt.ClientName).Err(); err == nil {
if err = conn.Hello(ctx, c.opt.Protocol, username, password, c.opt.ClientName).Err(); err == nil {
// Authentication successful with HELLO command
} else if !isRedisError(err) {
// When the server responds with the RESP protocol and the result is not a normal