From 9b5815fd9f28d90bda5fd7b1fa8df02c7f1d680a Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 19 Sep 2016 17:00:14 +0800 Subject: [PATCH] Upgrade redis client to v4. ref: http://godoc.org/gopkg.in/redis.v4 Signed-off-by: Bo-Yi Wu --- config/config.go | 2 +- config/config_test.go | 4 ++-- glide.lock | 14 ++++---------- glide.yaml | 2 +- storage/redis/redis.go | 2 +- 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/config/config.go b/config/config.go index ce68b58..8d77039 100644 --- a/config/config.go +++ b/config/config.go @@ -76,7 +76,7 @@ type SectionStat struct { type SectionRedis struct { Addr string `yaml:"addr"` Password string `yaml:"password"` - DB int64 `yaml:"db"` + DB int `yaml:"db"` } // SectionBoltDB is sub seciont of config. diff --git a/config/config_test.go b/config/config_test.go index 7d6a9fd..95af463 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -96,7 +96,7 @@ func (suite *ConfigTestSuite) TestValidateConfDefault() { assert.Equal(suite.T(), "memory", suite.ConfGorushDefault.Stat.Engine) assert.Equal(suite.T(), "localhost:6379", suite.ConfGorushDefault.Stat.Redis.Addr) assert.Equal(suite.T(), "", suite.ConfGorushDefault.Stat.Redis.Password) - assert.Equal(suite.T(), int64(0), suite.ConfGorushDefault.Stat.Redis.DB) + assert.Equal(suite.T(), 0, suite.ConfGorushDefault.Stat.Redis.DB) assert.Equal(suite.T(), "gorush.db", suite.ConfGorushDefault.Stat.BoltDB.Path) assert.Equal(suite.T(), "gorush", suite.ConfGorushDefault.Stat.BoltDB.Bucket) @@ -149,7 +149,7 @@ func (suite *ConfigTestSuite) TestValidateConf() { assert.Equal(suite.T(), "memory", suite.ConfGorush.Stat.Engine) assert.Equal(suite.T(), "localhost:6379", suite.ConfGorush.Stat.Redis.Addr) assert.Equal(suite.T(), "", suite.ConfGorush.Stat.Redis.Password) - assert.Equal(suite.T(), int64(0), suite.ConfGorush.Stat.Redis.DB) + assert.Equal(suite.T(), 0, suite.ConfGorush.Stat.Redis.DB) assert.Equal(suite.T(), "gorush.db", suite.ConfGorush.Stat.BoltDB.Path) assert.Equal(suite.T(), "gorush", suite.ConfGorush.Stat.BoltDB.Bucket) diff --git a/glide.lock b/glide.lock index 554ebfc..e2c7e7f 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 6aef366747559fbcb1075ebe6f923f2e5197544a0b02ce039d5120c7241e8df2 -updated: 2016-09-19T15:54:05.13589289+08:00 +hash: 4ee18de0a09fd239b069a5830dc26083f603fd14e06f8cada4c0934366ee343e +updated: 2016-09-19T16:53:10.40422002+08:00 imports: - name: github.com/asdine/storm version: 00b2f2df7ab7af9db746b826649395628cb5374e @@ -116,14 +116,8 @@ imports: version: 90f0b59102629831cc109845475a8d77043412ec - name: gopkg.in/go-playground/validator.v8 version: c193cecd124b5cc722d7ee5538e945bdb3348435 -- name: gopkg.in/redis.v3 - version: b5e368500d0a508ef8f16e9c2d4025a8a46bcc29 - subpackages: - - internal - - internal/hashtag - - internal/pool -- name: gopkg.in/redis.v3/internal/consistenthash - version: b5e368500d0a508ef8f16e9c2d4025a8a46bcc29 +- name: gopkg.in/redis.v4 + version: 938235994ea88a05678f8060741d5f34ed6a5ff3 - name: gopkg.in/yaml.v2 version: a83829b6f1293c91addabc89d0571c246397bbf4 testImports: diff --git a/glide.yaml b/glide.yaml index 3179b19..27c36d2 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,7 +1,6 @@ package: github.com/appleboy/gorush import: - package: gopkg.in/yaml.v2 -- package: gopkg.in/redis.v3 - package: github.com/Sirupsen/logrus version: v0.10.0 - package: gopkg.in/appleboy/gin-status-api.v1 @@ -20,3 +19,4 @@ import: - package: github.com/thoas/stats - package: github.com/tidwall/buntdb - package: github.com/syndtr/goleveldb +- package: gopkg.in/redis.v4 diff --git a/storage/redis/redis.go b/storage/redis/redis.go index 5f75558..dd0720b 100644 --- a/storage/redis/redis.go +++ b/storage/redis/redis.go @@ -2,7 +2,7 @@ package redis import ( "github.com/appleboy/gorush/config" - "gopkg.in/redis.v3" + "gopkg.in/redis.v4" "log" "strconv" )