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:
@@ -10,9 +10,8 @@
|
||||
package osutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"syscall"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// SetLowPriority lowers the process CPU scheduling priority, and possibly
|
||||
@@ -30,6 +29,8 @@ func SetLowPriority() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := syscall.Setpriority(syscall.PRIO_PROCESS, pidSelf, wantNiceLevel)
|
||||
return errors.Wrap(err, "set niceness") // wraps nil as nil
|
||||
if err := syscall.Setpriority(syscall.PRIO_PROCESS, pidSelf, wantNiceLevel); err != nil {
|
||||
return fmt.Errorf("set niceness: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user