Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

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

albertonyc502e00c8785
diff --git a/.golangci.yml b/.golangci.yml
index 2abdd1f5d..0f9d93813 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -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
diff --git a/fs/pacer.go b/fs/pacer.go
index fbbfb7d63..c8bac2230 100644
--- a/fs/pacer.go
+++ b/fs/pacer.go
@@ -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)