multi: fix fmt.Errorf error wrapping

Refactor fmt.Errorf usage to correctly wrap errors instead of using
non-wrapping format verbs.
This commit is contained in:
ffranr committed 2024-02-27 11:13:40 +00:00
1 parent 581c16d72f
commit cd566eb097
103 files changed
+426 -390

No files matched your search

+3 -3
View File
@@ -372,7 +372,7 @@ func printMacaroon(ctx *cli.Context) error {
// Decode the macaroon and its protobuf encoded internal identifier.
mac := &macaroon.Macaroon{}
if err = mac.UnmarshalBinary(macBytes); err != nil {
return fmt.Errorf("unable to decode macaroon: %v", err)
return fmt.Errorf("unable to decode macaroon: %w", err)
}
rawID := mac.Id()
if rawID[0] != byte(bakery.LatestVersion) {
@@ -382,7 +382,7 @@ func printMacaroon(ctx *cli.Context) error {
idProto := rawID[1:]
err = proto.Unmarshal(idProto, decodedID)
if err != nil {
return fmt.Errorf("unable to decode macaroon version: %v", err)
return fmt.Errorf("unable to decode macaroon version: %w", err)
}
// Prepare everything to be printed in a more human-readable format.
@@ -550,7 +550,7 @@ func applyMacaroonConstraints(ctx *cli.Context,
constrainedMac, err := macaroons.AddConstraints(mac, macConstraints...)
if err != nil {
return nil, fmt.Errorf("error adding constraints: %v", err)
return nil, fmt.Errorf("error adding constraints: %w", err)
}
return constrainedMac, nil