From b0948a37d4366e340317e4c290460176c677ca2b Mon Sep 17 00:00:00 2001 From: renovate Date: Thu, 21 May 2020 08:56:39 +0000 Subject: [PATCH] Update module go-redis/redis/v7 to v7.3.0 (#565) Update module go-redis/redis/v7 to v7.3.0 Reviewed-on: https://kolaente.dev/vikunja/api/pulls/565 --- go.mod | 2 +- go.sum | 2 ++ vendor/github.com/go-redis/redis/v7/.travis.yml | 1 - vendor/github.com/go-redis/redis/v7/CHANGELOG.md | 4 ++++ vendor/github.com/go-redis/redis/v7/README.md | 7 +++++-- vendor/github.com/go-redis/redis/v7/cluster.go | 11 ++++++++++- vendor/github.com/go-redis/redis/v7/command.go | 2 +- vendor/github.com/go-redis/redis/v7/commands.go | 10 ++++++++++ vendor/github.com/go-redis/redis/v7/error.go | 15 +++++++++++++++ .../go-redis/redis/v7/internal/pool/pool.go | 2 ++ .../go-redis/redis/v7/internal/proto/reader.go | 2 ++ .../go-redis/redis/v7/internal/proto/writer.go | 2 +- vendor/github.com/go-redis/redis/v7/options.go | 8 +++++++- vendor/github.com/go-redis/redis/v7/pubsub.go | 4 +++- vendor/github.com/go-redis/redis/v7/redis.go | 6 +++++- vendor/github.com/go-redis/redis/v7/result.go | 8 ++++++++ vendor/github.com/go-redis/redis/v7/ring.go | 10 +++++++++- vendor/github.com/go-redis/redis/v7/sentinel.go | 6 ++++++ vendor/github.com/go-redis/redis/v7/universal.go | 4 ++++ vendor/modules.txt | 2 +- 20 files changed, 96 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 845b98c687..9524ea020a 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/fzipp/gocyclo v0.0.0-20150627053110-6acd4345c835 github.com/go-openapi/jsonreference v0.19.3 // indirect github.com/go-openapi/spec v0.19.4 // indirect - github.com/go-redis/redis/v7 v7.2.0 + github.com/go-redis/redis/v7 v7.3.0 github.com/go-sql-driver/mysql v1.5.0 github.com/go-testfixtures/testfixtures/v3 v3.2.0 github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf diff --git a/go.sum b/go.sum index d3c3ee56c3..5efc9c9446 100644 --- a/go.sum +++ b/go.sum @@ -153,6 +153,8 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-redis/redis/v7 v7.2.0 h1:CrCexy/jYWZjW0AyVoHlcJUeZN19VWlbepTh1Vq6dJs= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v7 v7.3.0 h1:3oHqd0W7f/VLKBxeYTEpqdMUsmMectngjM9OtoRoIgg= +github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= diff --git a/vendor/github.com/go-redis/redis/v7/.travis.yml b/vendor/github.com/go-redis/redis/v7/.travis.yml index 0c1eef9188..a19ea1c52d 100644 --- a/vendor/github.com/go-redis/redis/v7/.travis.yml +++ b/vendor/github.com/go-redis/redis/v7/.travis.yml @@ -1,5 +1,4 @@ dist: xenial -sudo: false language: go services: diff --git a/vendor/github.com/go-redis/redis/v7/CHANGELOG.md b/vendor/github.com/go-redis/redis/v7/CHANGELOG.md index 88701cfd5a..bd4eccff24 100644 --- a/vendor/github.com/go-redis/redis/v7/CHANGELOG.md +++ b/vendor/github.com/go-redis/redis/v7/CHANGELOG.md @@ -4,6 +4,10 @@ - Existing `HMSet` is renamed to `HSet` and old deprecated `HMSet` is restored for Redis 3 users. +## v7.1 + +- Existing `Cmd.String` is renamed to `Cmd.Text`. New `Cmd.String` implements `fmt.Stringer` interface. + ## v7 - *Important*. Tx.Pipeline now returns a non-transactional pipeline. Use Tx.TxPipeline for a transactional pipeline. diff --git a/vendor/github.com/go-redis/redis/v7/README.md b/vendor/github.com/go-redis/redis/v7/README.md index 7331a56bf3..0fbb506ead 100644 --- a/vendor/github.com/go-redis/redis/v7/README.md +++ b/vendor/github.com/go-redis/redis/v7/README.md @@ -101,7 +101,7 @@ set, err := client.SetNX("key", "value", 10*time.Second).Result() vals, err := client.Sort("list", &redis.Sort{Offset: 0, Count: 2, Order: "ASC"}).Result() // ZRANGEBYSCORE zset -inf +inf WITHSCORES LIMIT 0 2 -vals, err := client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{ +vals, err := client.ZRangeByScoreWithScores("zset", &redis.ZRangeBy{ Min: "-inf", Max: "+inf", Offset: 0, @@ -109,7 +109,10 @@ vals, err := client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{ }).Result() // ZINTERSTORE out 2 zset1 zset2 WEIGHTS 2 3 AGGREGATE SUM -vals, err := client.ZInterStore("out", redis.ZStore{Weights: []int64{2, 3}}, "zset1", "zset2").Result() +vals, err := client.ZInterStore("out", &redis.ZStore{ + Keys: []string{"zset1", "zset2"}, + Weights: []int64{2, 3} +}).Result() // EVAL "return {KEYS[1],ARGV[1]}" 1 "key" "hello" vals, err := client.Eval("return {KEYS[1],ARGV[1]}", []string{"key"}, "hello").Result() diff --git a/vendor/github.com/go-redis/redis/v7/cluster.go b/vendor/github.com/go-redis/redis/v7/cluster.go index 2cf6e01b97..1907de6c41 100644 --- a/vendor/github.com/go-redis/redis/v7/cluster.go +++ b/vendor/github.com/go-redis/redis/v7/cluster.go @@ -57,6 +57,7 @@ type ClusterOptions struct { OnConnect func(*Conn) error + Username string Password string MaxRetries int @@ -67,6 +68,9 @@ type ClusterOptions struct { ReadTimeout time.Duration WriteTimeout time.Duration + // NewClient creates a cluster node client with provided name and options. + NewClient func(opt *Options) *Client + // PoolSize applies per cluster node and not for the whole cluster. PoolSize int MinIdleConns int @@ -118,6 +122,10 @@ func (opt *ClusterOptions) init() { case 0: opt.MaxRetryBackoff = 512 * time.Millisecond } + + if opt.NewClient == nil { + opt.NewClient = NewClient + } } func (opt *ClusterOptions) clientOptions() *Options { @@ -130,6 +138,7 @@ func (opt *ClusterOptions) clientOptions() *Options { MaxRetries: opt.MaxRetries, MinRetryBackoff: opt.MinRetryBackoff, MaxRetryBackoff: opt.MaxRetryBackoff, + Username: opt.Username, Password: opt.Password, readOnly: opt.ReadOnly, @@ -162,7 +171,7 @@ func newClusterNode(clOpt *ClusterOptions, addr string) *clusterNode { opt := clOpt.clientOptions() opt.Addr = addr node := clusterNode{ - Client: NewClient(opt), + Client: clOpt.NewClient(opt), } node.latency = math.MaxUint32 diff --git a/vendor/github.com/go-redis/redis/v7/command.go b/vendor/github.com/go-redis/redis/v7/command.go index 266e389232..fa1b03e3ea 100644 --- a/vendor/github.com/go-redis/redis/v7/command.go +++ b/vendor/github.com/go-redis/redis/v7/command.go @@ -671,7 +671,7 @@ func (cmd *StringCmd) Time() (time.Time, error) { if cmd.err != nil { return time.Time{}, cmd.err } - return time.Parse(time.RFC3339, cmd.Val()) + return time.Parse(time.RFC3339Nano, cmd.Val()) } func (cmd *StringCmd) Scan(val interface{}) error { diff --git a/vendor/github.com/go-redis/redis/v7/commands.go b/vendor/github.com/go-redis/redis/v7/commands.go index d4447c4d39..da5ceda13e 100644 --- a/vendor/github.com/go-redis/redis/v7/commands.go +++ b/vendor/github.com/go-redis/redis/v7/commands.go @@ -302,6 +302,7 @@ type Cmdable interface { type StatefulCmdable interface { Cmdable Auth(password string) *StatusCmd + AuthACL(username, password string) *StatusCmd Select(index int) *StatusCmd SwapDB(index1, index2 int) *StatusCmd ClientSetName(name string) *BoolCmd @@ -324,6 +325,15 @@ func (c statefulCmdable) Auth(password string) *StatusCmd { return cmd } +// Perform an AUTH command, using the given user and pass. +// Should be used to authenticate the current connection with one of the connections defined in the ACL list +// when connecting to a Redis 6.0 instance, or greater, that is using the Redis ACL system. +func (c statefulCmdable) AuthACL(username, password string) *StatusCmd { + cmd := NewStatusCmd("auth", username, password) + _ = c(cmd) + return cmd +} + func (c cmdable) Echo(message interface{}) *StringCmd { cmd := NewStringCmd("echo", message) _ = c(cmd) diff --git a/vendor/github.com/go-redis/redis/v7/error.go b/vendor/github.com/go-redis/redis/v7/error.go index a84c44f125..0ffaca9f8f 100644 --- a/vendor/github.com/go-redis/redis/v7/error.go +++ b/vendor/github.com/go-redis/redis/v7/error.go @@ -6,9 +6,24 @@ import ( "net" "strings" + "github.com/go-redis/redis/v7/internal/pool" "github.com/go-redis/redis/v7/internal/proto" ) +var ErrClosed = pool.ErrClosed + +type Error interface { + error + + // RedisError is a no-op function but + // serves to distinguish types that are Redis + // errors from ordinary errors: a type is a + // Redis error if it has a RedisError method. + RedisError() +} + +var _ Error = proto.RedisError("") + func isRetryableError(err error, retryTimeout bool) bool { switch err { case nil, context.Canceled, context.DeadlineExceeded: diff --git a/vendor/github.com/go-redis/redis/v7/internal/pool/pool.go b/vendor/github.com/go-redis/redis/v7/internal/pool/pool.go index bbf5b30048..a8d8276a9f 100644 --- a/vendor/github.com/go-redis/redis/v7/internal/pool/pool.go +++ b/vendor/github.com/go-redis/redis/v7/internal/pool/pool.go @@ -94,7 +94,9 @@ func NewConnPool(opt *Options) *ConnPool { closedCh: make(chan struct{}), } + p.connsMu.Lock() p.checkMinIdleConns() + p.connsMu.Unlock() if opt.IdleTimeout > 0 && opt.IdleCheckFrequency > 0 { go p.reaper(opt.IdleCheckFrequency) diff --git a/vendor/github.com/go-redis/redis/v7/internal/proto/reader.go b/vendor/github.com/go-redis/redis/v7/internal/proto/reader.go index 24fc0bd86f..d3f646e98f 100644 --- a/vendor/github.com/go-redis/redis/v7/internal/proto/reader.go +++ b/vendor/github.com/go-redis/redis/v7/internal/proto/reader.go @@ -24,6 +24,8 @@ type RedisError string func (e RedisError) Error() string { return string(e) } +func (RedisError) RedisError() {} + //------------------------------------------------------------------------------ type MultiBulkParse func(*Reader, int64) (interface{}, error) diff --git a/vendor/github.com/go-redis/redis/v7/internal/proto/writer.go b/vendor/github.com/go-redis/redis/v7/internal/proto/writer.go index cd83d65808..d552f1e84d 100644 --- a/vendor/github.com/go-redis/redis/v7/internal/proto/writer.go +++ b/vendor/github.com/go-redis/redis/v7/internal/proto/writer.go @@ -93,7 +93,7 @@ func (w *Writer) writeArg(v interface{}) error { } return w.int(0) case time.Time: - return w.string(v.Format(time.RFC3339)) + return w.string(v.Format(time.RFC3339Nano)) case encoding.BinaryMarshaler: b, err := v.MarshalBinary() if err != nil { diff --git a/vendor/github.com/go-redis/redis/v7/options.go b/vendor/github.com/go-redis/redis/v7/options.go index 621d3a3716..47dcc29bf3 100644 --- a/vendor/github.com/go-redis/redis/v7/options.go +++ b/vendor/github.com/go-redis/redis/v7/options.go @@ -40,8 +40,13 @@ type Options struct { // Hook that is called when new connection is established. OnConnect func(*Conn) error + // Use the specified Username to authenticate the current connection with one of the connections defined in the ACL + // list when connecting to a Redis 6.0 instance, or greater, that is using the Redis ACL system. + Username string + // Optional password. Must match the password specified in the - // requirepass server configuration option. + // requirepass server configuration option (if connecting to a Redis 5.0 instance, or lower), + // or the User Password when connecting to a Redis 6.0 instance, or greater, that is using the Redis ACL system. Password string // Database to be selected after connecting to the server. DB int @@ -187,6 +192,7 @@ func ParseURL(redisURL string) (*Options, error) { } if u.User != nil { + o.Username = u.User.Username() if p, ok := u.User.Password(); ok { o.Password = p } diff --git a/vendor/github.com/go-redis/redis/v7/pubsub.go b/vendor/github.com/go-redis/redis/v7/pubsub.go index e11640932a..26cde242be 100644 --- a/vendor/github.com/go-redis/redis/v7/pubsub.go +++ b/vendor/github.com/go-redis/redis/v7/pubsub.go @@ -309,9 +309,11 @@ func (c *PubSub) newMessage(reply interface{}) (interface{}, error) { case []interface{}: switch kind := reply[0].(string); kind { case "subscribe", "unsubscribe", "psubscribe", "punsubscribe": + // Can be nil in case of "unsubscribe". + channel, _ := reply[1].(string) return &Subscription{ Kind: kind, - Channel: reply[1].(string), + Channel: channel, Count: int(reply[2].(int64)), }, nil case "message": diff --git a/vendor/github.com/go-redis/redis/v7/redis.go b/vendor/github.com/go-redis/redis/v7/redis.go index 93032579c1..3d9dfed7db 100644 --- a/vendor/github.com/go-redis/redis/v7/redis.go +++ b/vendor/github.com/go-redis/redis/v7/redis.go @@ -241,7 +241,11 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error { _, err := conn.Pipelined(func(pipe Pipeliner) error { if c.opt.Password != "" { - pipe.Auth(c.opt.Password) + if c.opt.Username != "" { + pipe.AuthACL(c.opt.Username, c.opt.Password) + } else { + pipe.Auth(c.opt.Password) + } } if c.opt.DB > 0 { diff --git a/vendor/github.com/go-redis/redis/v7/result.go b/vendor/github.com/go-redis/redis/v7/result.go index 4b7de63a12..5bec26ca95 100644 --- a/vendor/github.com/go-redis/redis/v7/result.go +++ b/vendor/github.com/go-redis/redis/v7/result.go @@ -98,6 +98,14 @@ func NewStringIntMapCmdResult(val map[string]int64, err error) *StringIntMapCmd return &cmd } +// NewTimeCmdResult returns a TimeCmd initialised with val and err for testing +func NewTimeCmdResult(val time.Time, err error) *TimeCmd { + var cmd TimeCmd + cmd.val = val + cmd.SetErr(err) + return &cmd +} + // NewZSliceCmdResult returns a ZSliceCmd initialised with val and err for testing func NewZSliceCmdResult(val []Z, err error) *ZSliceCmd { var cmd ZSliceCmd diff --git a/vendor/github.com/go-redis/redis/v7/ring.go b/vendor/github.com/go-redis/redis/v7/ring.go index e1b499174a..44fc623f8a 100644 --- a/vendor/github.com/go-redis/redis/v7/ring.go +++ b/vendor/github.com/go-redis/redis/v7/ring.go @@ -56,6 +56,9 @@ type RingOptions struct { // See https://arxiv.org/abs/1406.2294 for reference HashReplicas int + // NewClient creates a shard client with provided name and options. + NewClient func(name string, opt *Options) *Client + // Optional hook that is called when a new shard is created. OnNewShard func(*Client) @@ -390,7 +393,12 @@ func NewRing(opt *RingOptions) *Ring { func newRingShard(opt *RingOptions, name, addr string) *Client { clopt := opt.clientOptions(name) clopt.Addr = addr - shard := NewClient(clopt) + var shard *Client + if opt.NewClient != nil { + shard = opt.NewClient(name, clopt) + } else { + shard = NewClient(clopt) + } if opt.OnNewShard != nil { opt.OnNewShard(shard) } diff --git a/vendor/github.com/go-redis/redis/v7/sentinel.go b/vendor/github.com/go-redis/redis/v7/sentinel.go index 6487ef63f1..8aa40ef799 100644 --- a/vendor/github.com/go-redis/redis/v7/sentinel.go +++ b/vendor/github.com/go-redis/redis/v7/sentinel.go @@ -22,6 +22,7 @@ type FailoverOptions struct { MasterName string // A seed list of host:port addresses of sentinel nodes. SentinelAddrs []string + SentinelUsername string SentinelPassword string // Following options are copied from Options struct. @@ -29,6 +30,7 @@ type FailoverOptions struct { Dialer func(ctx context.Context, network, addr string) (net.Conn, error) OnConnect func(*Conn) error + Username string Password string DB int @@ -57,6 +59,7 @@ func (opt *FailoverOptions) options() *Options { OnConnect: opt.OnConnect, DB: opt.DB, + Username: opt.Username, Password: opt.Password, MaxRetries: opt.MaxRetries, @@ -88,6 +91,7 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client { failover := &sentinelFailover{ masterName: failoverOpt.MasterName, sentinelAddrs: failoverOpt.SentinelAddrs, + username: failoverOpt.SentinelUsername, password: failoverOpt.SentinelPassword, opt: opt, @@ -281,6 +285,7 @@ type sentinelFailover struct { sentinelAddrs []string opt *Options + username string password string pool *pool.ConnPool @@ -372,6 +377,7 @@ func (c *sentinelFailover) masterAddr() (string, error) { Addr: sentinelAddr, Dialer: c.opt.Dialer, + Username: c.username, Password: c.password, MaxRetries: c.opt.MaxRetries, diff --git a/vendor/github.com/go-redis/redis/v7/universal.go b/vendor/github.com/go-redis/redis/v7/universal.go index 21c4d07abf..005ca682c5 100644 --- a/vendor/github.com/go-redis/redis/v7/universal.go +++ b/vendor/github.com/go-redis/redis/v7/universal.go @@ -22,6 +22,7 @@ type UniversalOptions struct { Dialer func(ctx context.Context, network, addr string) (net.Conn, error) OnConnect func(*Conn) error + Username string Password string MaxRetries int MinRetryBackoff time.Duration @@ -60,6 +61,7 @@ func (o *UniversalOptions) Cluster() *ClusterOptions { Dialer: o.Dialer, OnConnect: o.OnConnect, + Username: o.Username, Password: o.Password, MaxRedirects: o.MaxRedirects, @@ -99,6 +101,7 @@ func (o *UniversalOptions) Failover() *FailoverOptions { OnConnect: o.OnConnect, DB: o.DB, + Username: o.Username, Password: o.Password, MaxRetries: o.MaxRetries, @@ -133,6 +136,7 @@ func (o *UniversalOptions) Simple() *Options { OnConnect: o.OnConnect, DB: o.DB, + Username: o.Username, Password: o.Password, MaxRetries: o.MaxRetries, diff --git a/vendor/modules.txt b/vendor/modules.txt index 95af14f0ad..215962410c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -66,7 +66,7 @@ github.com/go-openapi/jsonreference github.com/go-openapi/spec # github.com/go-openapi/swag v0.19.5 github.com/go-openapi/swag -# github.com/go-redis/redis/v7 v7.2.0 +# github.com/go-redis/redis/v7 v7.3.0 github.com/go-redis/redis/v7 github.com/go-redis/redis/v7/internal github.com/go-redis/redis/v7/internal/consistenthash