Skip to content

Commit 47020a1

Browse files
committed
update...
1 parent 0e8efc0 commit 47020a1

File tree

4 files changed

+40
-32
lines changed

4 files changed

+40
-32
lines changed

.golangci.yml

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
run:
2-
timeout: 10m
1+
version: "2"
32
linters:
4-
disable-all: true
3+
default: none
54
enable:
65
- asciicheck
76
- bidichk
@@ -14,18 +13,14 @@ linters:
1413
- errname
1514
- errorlint
1615
- exhaustive
17-
- exportloopref
1816
- gocognit
1917
- goconst
2018
- gocritic
2119
- gocyclo
22-
- gofmt
2320
- gomodguard
24-
- gosimple
2521
- importas
2622
- ineffassign
2723
- makezero
28-
- megacheck
2924
- nakedret
3025
- nilerr
3126
- nilnil
@@ -35,23 +30,36 @@ linters:
3530
- prealloc
3631
- predeclared
3732
- staticcheck
38-
- stylecheck
39-
- tenv
40-
- typecheck
4133
- unconvert
4234
- unused
4335
- whitespace
44-
fast: false
45-
issues:
46-
exclude:
47-
- "SA1019"
48-
- "ST1003"
49-
- "regexpMust"
50-
output:
51-
staticcheck:
52-
checks: [ "all" ]
53-
stylecheck:
54-
checks: [ "all" ]
55-
gosec:
56-
severity: "high"
57-
confidence: "high"
36+
exclusions:
37+
generated: lax
38+
presets:
39+
- comments
40+
- common-false-positives
41+
- legacy
42+
- std-error-handling
43+
rules:
44+
- path: (.+)\.go$
45+
text: SA1019
46+
- path: (.+)\.go$
47+
text: ST1003
48+
- path: (.+)\.go$
49+
text: regexpMust
50+
- linters:
51+
- staticcheck
52+
text: "QF1008:"
53+
paths:
54+
- third_party$
55+
- builtin$
56+
- examples$
57+
formatters:
58+
enable:
59+
- gofmt
60+
exclusions:
61+
generated: lax
62+
paths:
63+
- third_party$
64+
- builtin$
65+
- examples$

exponential_backoff.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ func (b *exponentialBackoff) NextDelay(failures int) time.Duration {
5858
if failures == 0 {
5959
return b.config.BaseDelay
6060
}
61-
backoff, max := float64(b.config.BaseDelay), float64(b.config.MaxDelay)
62-
for backoff < max && failures > 0 {
61+
backoff, mx := float64(b.config.BaseDelay), float64(b.config.MaxDelay)
62+
for backoff < mx && failures > 0 {
6363
backoff *= b.config.Multiplier
6464
failures--
6565
}
66-
if backoff > max {
67-
backoff = max
66+
if backoff > mx {
67+
backoff = mx
6868
}
6969
// Randomize the backoff delay, so we don't have multiple delays waking up at the same instants
7070
backoff = addRandomJitterToDelay(backoff, b.config.BaseDelay, b.config.Jitter)

fibonacci_backoff.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ func (b *fibonacciBackoff) NextDelay(failures int) time.Duration {
6464
if failures == 0 {
6565
return b.config.Delay
6666
}
67-
max := float64(b.config.MaxDelay)
67+
mx := float64(b.config.MaxDelay)
6868
backoff := float64(b.config.Delay) * float64(b.nextDelay(failures))
69-
if backoff > max {
70-
backoff = max
69+
if backoff > mx {
70+
backoff = mx
7171
}
7272
// Randomize the backoff delay, so we don't have multiple delays waking up at the same instants
7373
backoff = addRandomJitterToDelay(backoff, b.config.Delay, b.config.Jitter)

gotries.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var (
2424
defaultOptions []Option
2525
globalLock sync.RWMutex
2626
DefaultRecoverableErrorPredicate = func(err error) bool {
27-
return !(errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded))
27+
return !errors.Is(err, context.Canceled)
2828
}
2929
)
3030

0 commit comments

Comments
 (0)