Skip to content

Commit 321a1f6

Browse files
committed
change staticchecks settings
1 parent 72fabf5 commit 321a1f6

File tree

7 files changed

+36
-25
lines changed

7 files changed

+36
-25
lines changed

.golangci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ run:
33
timeout: 5m
44
tests: false
55
linters:
6+
settings:
7+
staticcheck:
8+
checks:
9+
- all
10+
# Incorrect or missing package comment.
11+
# https://staticcheck.dev/docs/checks/#ST1000
12+
- -ST1000
13+
# Omit embedded fields from selector expression.
14+
# https://staticcheck.dev/docs/checks/#QF1008
15+
- -QF1008
16+
- -ST1003
617
exclusions:
718
generated: lax
819
presets:

json.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (cmd *JSONCmd) Expanded() (interface{}, error) {
113113

114114
func (cmd *JSONCmd) readReply(rd *proto.Reader) error {
115115
// nil response from JSON.(M)GET (cmd.baseCmd.err will be "redis: nil")
116-
if cmd.Err() == Nil {
116+
if cmd.baseCmd.Err() == Nil {
117117
cmd.val = ""
118118
return Nil
119119
}
@@ -182,7 +182,7 @@ func (cmd *JSONSliceCmd) Result() ([]interface{}, error) {
182182
}
183183

184184
func (cmd *JSONSliceCmd) readReply(rd *proto.Reader) error {
185-
if cmd.Err() == Nil {
185+
if cmd.baseCmd.Err() == Nil {
186186
cmd.val = nil
187187
return Nil
188188
}

redis.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -677,16 +677,16 @@ func NewClient(opt *Options) *Client {
677677
func (c *Client) init() {
678678
c.cmdable = c.Process
679679
c.initHooks(hooks{
680-
dial: c.dial,
681-
process: c.process,
682-
pipeline: c.processPipeline,
683-
txPipeline: c.processTxPipeline,
680+
dial: c.baseClient.dial,
681+
process: c.baseClient.process,
682+
pipeline: c.baseClient.processPipeline,
683+
txPipeline: c.baseClient.processTxPipeline,
684684
})
685685
}
686686

687687
func (c *Client) WithTimeout(timeout time.Duration) *Client {
688688
clone := *c
689-
clone.baseClient = c.withTimeout(timeout)
689+
clone.baseClient = c.baseClient.withTimeout(timeout)
690690
clone.init()
691691
return &clone
692692
}
@@ -839,10 +839,10 @@ func newConn(opt *Options, connPool pool.Pooler) *Conn {
839839
c.cmdable = c.Process
840840
c.statefulCmdable = c.Process
841841
c.initHooks(hooks{
842-
dial: c.dial,
843-
process: c.process,
844-
pipeline: c.processPipeline,
845-
txPipeline: c.processTxPipeline,
842+
dial: c.baseClient.dial,
843+
process: c.baseClient.process,
844+
pipeline: c.baseClient.processPipeline,
845+
txPipeline: c.baseClient.processTxPipeline,
846846
})
847847

848848
return &c

sentinel.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ func NewSentinelClient(opt *Options) *SentinelClient {
321321
}
322322

323323
c.initHooks(hooks{
324-
dial: c.dial,
325-
process: c.process,
324+
dial: c.baseClient.dial,
325+
process: c.baseClient.process,
326326
})
327327
c.connPool = newConnPool(opt, c.dialHook)
328328

sentinel_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var _ = Describe("Sentinel resolution", func() {
4141
client := redis.NewFailoverClient(&redis.FailoverOptions{
4242
MasterName: sentinelName,
4343
SentinelAddrs: sentinelAddrs,
44-
MaxRetries: -1,
44+
MaxRetries: -1,
4545
})
4646

4747
err := client.Ping(shortCtx).Err()

tx.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ func (c *Tx) init() {
3939
c.statefulCmdable = c.Process
4040

4141
c.initHooks(hooks{
42-
dial: c.dial,
43-
process: c.process,
44-
pipeline: c.processPipeline,
45-
txPipeline: c.processTxPipeline,
42+
dial: c.baseClient.dial,
43+
process: c.baseClient.process,
44+
pipeline: c.baseClient.processPipeline,
45+
txPipeline: c.baseClient.processTxPipeline,
4646
})
4747
}
4848

universal.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,13 @@ var (
259259
// NewUniversalClient returns a new multi client. The type of the returned client depends
260260
// on the following conditions:
261261
//
262-
// 1. If the MasterName option is specified with RouteByLatency, RouteRandomly or IsClusterMode,
263-
// a FailoverClusterClient is returned.
264-
// 2. If the MasterName option is specified without RouteByLatency, RouteRandomly or IsClusterMode,
265-
// a sentinel-backed FailoverClient is returned.
266-
// 3. If the number of Addrs is two or more, or IsClusterMode option is specified,
267-
// a ClusterClient is returned.
268-
// 4. Otherwise, a single-node Client is returned.
262+
// 1. If the MasterName option is specified with RouteByLatency, RouteRandomly or IsClusterMode,
263+
// a FailoverClusterClient is returned.
264+
// 2. If the MasterName option is specified without RouteByLatency, RouteRandomly or IsClusterMode,
265+
// a sentinel-backed FailoverClient is returned.
266+
// 3. If the number of Addrs is two or more, or IsClusterMode option is specified,
267+
// a ClusterClient is returned.
268+
// 4. Otherwise, a single-node Client is returned.
269269
func NewUniversalClient(opts *UniversalOptions) UniversalClient {
270270
switch {
271271
case opts.MasterName != "" && (opts.RouteByLatency || opts.RouteRandomly || opts.IsClusterMode):

0 commit comments

Comments
 (0)