Skip to content

Commit

Permalink
Update storage deps (Redis v7->v9)
Browse files Browse the repository at this point in the history
  • Loading branch information
brainexe committed Aug 26, 2023
1 parent 565c4f8 commit 6ed86cd
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 59 deletions.
2 changes: 1 addition & 1 deletion bot/storage/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"path/filepath"
"strings"

scribble "github.com/nanobox-io/golang-scribble"
scribble "github.com/sdomino/golang-scribble"

Check failure on line 8 in bot/storage/file.go

View workflow job for this annotation

GitHub Actions / Lint

import 'github.com/sdomino/golang-scribble' is not allowed from list 'Main' (depguard)
)

func newFileStorage(dir string) (Storage, error) {
Expand Down
15 changes: 10 additions & 5 deletions bot/storage/redis.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package storage

import (
"context"
"encoding/json"

"github.com/go-redis/redis/v7"
"github.com/redis/go-redis/v9"

Check failure on line 7 in bot/storage/redis.go

View workflow job for this annotation

GitHub Actions / Lint

import 'github.com/redis/go-redis/v9' is not allowed from list 'Main' (depguard)
)

// NewRedisStorage defined a redis bases storage to persist bot related information
Expand All @@ -23,13 +24,15 @@ func (s redisStorage) Write(collection, key string, v any) error {
return err
}

s.client.HSet(collection, key, string(data))
ctx := context.Background()
s.client.HSet(ctx, collection, key, string(data))

return nil
}

func (s redisStorage) Read(collection, key string, v any) error {
res, err := s.client.HGet(collection, key).Result()
ctx := context.Background()
res, err := s.client.HGet(ctx, collection, key).Result()
if err != nil {
return err
}
Expand All @@ -38,7 +41,8 @@ func (s redisStorage) Read(collection, key string, v any) error {
}

func (s redisStorage) GetKeys(collection string) ([]string, error) {
res, err := s.client.HKeys(collection).Result()
ctx := context.Background()
res, err := s.client.HKeys(ctx, collection).Result()
if err != nil {
return nil, err
}
Expand All @@ -47,7 +51,8 @@ func (s redisStorage) GetKeys(collection string) ([]string, error) {
}

func (s redisStorage) Delete(collection, key string) error {
_, err := s.client.HDel(collection, key).Result()
ctx := context.Background()
_, err := s.client.HDel(ctx, collection, key).Result()

return err
}
5 changes: 2 additions & 3 deletions bot/storage/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package storage
import (
"testing"

"github.com/stretchr/testify/assert"

"github.com/alicebob/miniredis/v2"
"github.com/go-redis/redis/v7"
"github.com/redis/go-redis/v9"

Check failure on line 7 in bot/storage/redis_test.go

View workflow job for this annotation

GitHub Actions / Lint

import 'github.com/redis/go-redis/v9' is not allowed from list 'Main' (depguard)
"github.com/stretchr/testify/assert"

Check failure on line 8 in bot/storage/redis_test.go

View workflow job for this annotation

GitHub Actions / Lint

import 'github.com/stretchr/testify/assert' is not allowed from list 'Main' (depguard)
)

func TestRedisStorage(t *testing.T) {
Expand Down
28 changes: 15 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
module github.com/innogames/slack-bot/v2

go 1.19
go 1.20

require (
github.com/alicebob/miniredis/v2 v2.30.5
github.com/andygrunwald/go-jira v1.16.0
github.com/aws/aws-sdk-go v1.44.319
github.com/aws/aws-sdk-go v1.44.331
github.com/bndr/gojenkins v1.1.0
github.com/brainexe/viper v1.8.2
github.com/gfleury/go-bitbucket-v1 v0.0.0-20230626192437-8d7be5866751
github.com/go-redis/redis/v7 v7.4.1
github.com/gfleury/go-bitbucket-v1 v0.0.0-20230825095122-9bc1711434ab
github.com/google/go-github v17.0.0+incompatible
github.com/gookit/color v1.5.4
github.com/hackebrot/turtle v0.2.0
github.com/nanobox-io/golang-scribble v0.0.0-20190309225732-aa3e7c118975
github.com/pkg/errors v0.9.1
github.com/redis/go-redis/v9 v9.1.0
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/robfig/cron/v3 v3.0.1
github.com/sdomino/golang-scribble v0.0.0-20230717151034-b95d4df19aa8
github.com/sirupsen/logrus v1.9.3
github.com/slack-go/slack v0.12.3
github.com/stretchr/testify v1.8.4
Expand All @@ -29,38 +29,40 @@ require (

require (
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.2.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jcelliott/lumber v0.0.0-20160324203708-dd349441af25 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.16.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/trivago/tgo v1.0.7 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yuin/gopher-lua v1.1.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit 6ed86cd

Please sign in to comment.