mirror of
https://github.com/rclone/rclone.git
synced 2025-08-19 09:52:05 +02: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:
@@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rclone/rclone/cmd"
|
||||
"github.com/rclone/rclone/cmd/ls/lshelp"
|
||||
"github.com/rclone/rclone/fs"
|
||||
@@ -125,11 +124,11 @@ can be processed line by line as each item is written one to a line.
|
||||
}
|
||||
out, err := json.MarshalIndent(item, "", "\t")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to marshal list object")
|
||||
return fmt.Errorf("failed to marshal list object: %w", err)
|
||||
}
|
||||
_, err = os.Stdout.Write(out)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to write to output")
|
||||
return fmt.Errorf("failed to write to output: %w", err)
|
||||
}
|
||||
fmt.Println()
|
||||
} else {
|
||||
@@ -138,7 +137,7 @@ can be processed line by line as each item is written one to a line.
|
||||
err := operations.ListJSON(context.Background(), fsrc, remote, &opt, func(item *operations.ListJSONItem) error {
|
||||
out, err := json.Marshal(item)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to marshal list object")
|
||||
return fmt.Errorf("failed to marshal list object: %w", err)
|
||||
}
|
||||
if first {
|
||||
first = false
|
||||
@@ -147,7 +146,7 @@ can be processed line by line as each item is written one to a line.
|
||||
}
|
||||
_, err = os.Stdout.Write(out)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to write to output")
|
||||
return fmt.Errorf("failed to write to output: %w", err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
Reference in New Issue
Block a user