1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-06 10:33:34 +00:00

Remove github.com/pkg/errors and replace with std library version

This is possible now that we no longer support go1.12 and brings
rclone into line with standard practices in the Go world.

This also removes errors.New and errors.Errorf from lib/errors and
prefers the stdlib errors package over lib/errors.
This commit is contained in:
Nick Craig-Wood
2021-11-04 10:12:57 +00:00
parent 97328e5755
commit e43b5ce5e5
233 changed files with 1673 additions and 1695 deletions

View File

@@ -4,11 +4,11 @@
package mountlib
import (
"fmt"
"io"
"os"
"time"
"github.com/pkg/errors"
"github.com/rclone/rclone/fs"
)
@@ -17,7 +17,7 @@ import (
func CheckMountEmpty(mountpoint string) error {
fp, err := os.Open(mountpoint)
if err != nil {
return errors.Wrapf(err, "Can not open: %s", mountpoint)
return fmt.Errorf("Can not open: %s: %w", mountpoint, err)
}
defer fs.CheckClose(fp, &err)
@@ -28,9 +28,9 @@ func CheckMountEmpty(mountpoint string) error {
const msg = "Directory is not empty, use --allow-non-empty to mount anyway: %s"
if err == nil {
return errors.Errorf(msg, mountpoint)
return fmt.Errorf(msg, mountpoint)
}
return errors.Wrapf(err, msg, mountpoint)
return fmt.Errorf(msg+": %w", mountpoint, err)
}
// CheckMountReady should check if mountpoint is mounted by rclone.