Skip to content

Commit 4fffdf8

Browse files
authored
Fix lint errors (#48)
1 parent 6cd26c1 commit 4fffdf8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ linters:
8080
- usetesting
8181
- wastedassign
8282
- whitespace
83-
# - wrapcheck
83+
- wrapcheck
8484
disable-all: true
8585
issues:
8686
max-issues-per-linter: 0

client.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ func Wrap(client redis.UniversalClient) Client {
4141
return contextClusterClient{ClusterClient: client}
4242
case *redis.Ring:
4343
return contextRingClient{Ring: client}
44+
default:
45+
if c, ok := client.(Client); ok {
46+
return c
47+
}
48+
// Handle the case where client doesn't implement the Client interface
49+
panic(fmt.Sprintf("unsupported redis client type: %T", client))
4450
}
45-
46-
return client.(Client)
4751
}
4852

4953
type contextClient struct {
@@ -126,8 +130,7 @@ func process(ctx context.Context) func(oldProcess func(cmd redis.Cmder) error) f
126130
func processPipeline(ctx context.Context) func(oldProcess func(cmds []redis.Cmder) error) func(cmds []redis.Cmder) error {
127131
return func(oldProcess func(cmds []redis.Cmder) error) func(cmds []redis.Cmder) error {
128132
return func(cmds []redis.Cmder) error {
129-
pipelineSpan, ctx := opentracing.StartSpanFromContext(ctx, "(pipeline)")
130-
133+
pipelineSpan, pipelineCtx := opentracing.StartSpanFromContext(ctx, "(pipeline)")
131134
ext.DBType.Set(pipelineSpan, "redis")
132135

133136
for i := len(cmds); i > 0; i-- {
@@ -136,7 +139,7 @@ func processPipeline(ctx context.Context) func(oldProcess func(cmds []redis.Cmde
136139
cmdName = "(empty command)"
137140
}
138141

139-
span, _ := opentracing.StartSpanFromContext(ctx, cmdName)
142+
span, _ := opentracing.StartSpanFromContext(pipelineCtx, cmdName)
140143
ext.DBType.Set(span, "redis")
141144
ext.DBStatement.Set(span, fmt.Sprintf("%v", cmds[i-1].Args()))
142145
defer span.Finish()

0 commit comments

Comments
 (0)