mirror of
https://github.com/rclone/rclone.git
synced 2026-01-06 18:43:50 +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:
@@ -4,11 +4,10 @@ package configmap
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Priority of getters
|
||||
@@ -172,7 +171,7 @@ func (c Simple) Encode() (string, error) {
|
||||
}
|
||||
buf, err := json.Marshal(c)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "encode simple map")
|
||||
return "", fmt.Errorf("encode simple map: %w", err)
|
||||
}
|
||||
return base64.RawStdEncoding.EncodeToString(buf), nil
|
||||
}
|
||||
@@ -191,11 +190,11 @@ func (c Simple) Decode(in string) error {
|
||||
}
|
||||
decodedM, err := base64.RawStdEncoding.DecodeString(in)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "decode simple map")
|
||||
return fmt.Errorf("decode simple map: %w", err)
|
||||
}
|
||||
err = json.Unmarshal(decodedM, &c)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "parse simple map")
|
||||
return fmt.Errorf("parse simple map: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user