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:
@@ -8,11 +8,10 @@ package model
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
@@ -177,12 +176,12 @@ func (s *sharedPullerState) tempFileInWritableDir(_ string) error {
|
||||
// what the umask dictates.
|
||||
|
||||
if err := s.fs.Chmod(s.tempName, mode); err != nil {
|
||||
return errors.Wrap(err, "setting perms on temp file")
|
||||
return fmt.Errorf("setting perms on temp file: %w", err)
|
||||
}
|
||||
}
|
||||
fd, err := s.fs.OpenFile(s.tempName, flags, mode)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "opening temp file")
|
||||
return fmt.Errorf("opening temp file: %w", err)
|
||||
}
|
||||
|
||||
// Hide the temporary file
|
||||
|
||||
Reference in New Issue
Block a user