fs: fix infinite recursive call in pacer ModifyCalculator (fixes issue reported by the staticcheck linter)

This commit is contained in:
albertony 2023-03-26 13:10:52 +02:00
parent 9172c9b3dd
commit c502e00c87
2 changed files with 1 additions and 9 deletions

View File

@ -37,14 +37,6 @@ issues:
- staticcheck
text: 'SA1019: "golang.org/x/oauth2/jws" is deprecated'
# TODO: Investigate if this is a real issue. If not, i.e. it is a false
# positive, consider instead excluding this check using a code comment!
- path: ^fs[\\/]pacer\.go$
linters:
- staticcheck
text: 'SA5007: infinite recursive call'
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 10m

View File

@ -73,7 +73,7 @@ func (p *Pacer) SetCalculator(c pacer.Calculator) {
// ModifyCalculator calls the given function with the currently configured
// Calculator and the Pacer lock held.
func (p *Pacer) ModifyCalculator(f func(pacer.Calculator)) {
p.ModifyCalculator(func(c pacer.Calculator) {
p.Pacer.ModifyCalculator(func(c pacer.Calculator) {
switch _c := c.(type) {
case *logCalculator:
f(_c.Calculator)