diff --git a/v1/locks/redis/redis.go b/v1/locks/redis/redis.go index aaa5a188e..d434874ba 100644 --- a/v1/locks/redis/redis.go +++ b/v1/locks/redis/redis.go @@ -28,11 +28,10 @@ func New(cnf *config.Config, addrs []string, db, retries int) Lock { var password string - i := strings.LastIndex(addrs[0], "@") - if i > 0 { - // with passwrod - password = addrs[0][i+1:] - addrs[0] = addrs[0][:i] + parts := strings.Split(addrs[0], "@") + if len(parts) == 2 { + password = parts[0] + addrs[0] = parts[1] } ropt := &redis.UniversalOptions{