all: Modernize error wrapping (#8491)
This replaces old style errors.Wrap with modern fmt.Errorf and removes the (direct) dependency on github.com/pkg/errors. A couple of cases are adjusted by hand as previously errors.Wrap(nil, ...) would return nil, which is not what fmt.Errorf does.
This commit is contained in:
+3
-3
@@ -8,6 +8,7 @@ package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"path/filepath"
|
||||
@@ -15,8 +16,6 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/config"
|
||||
"github.com/syncthing/syncthing/lib/db"
|
||||
"github.com/syncthing/syncthing/lib/events"
|
||||
@@ -317,7 +316,7 @@ func (f *folder) getHealthErrorAndLoadIgnores() error {
|
||||
}
|
||||
if f.Type != config.FolderTypeReceiveEncrypted {
|
||||
if err := f.ignores.Load(".stignore"); err != nil && !fs.IsNotExist(err) {
|
||||
return errors.Wrap(err, "loading ignores")
|
||||
return fmt.Errorf("loading ignores: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -1060,6 +1059,7 @@ func (f *folder) monitorWatch(ctx context.Context) {
|
||||
l.Warnf("Filesystem watching (kqueue) is enabled on %v with a lot of files/directories, and that requires a lot of resources and might slow down your system significantly", f.Description())
|
||||
}
|
||||
case <-ctx.Done():
|
||||
aggrCancel() // for good measure and keeping the linters happy
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user