*: fmt.Errorf: use %w when appropriate

This should result in no change when the error is printed, but make the
errors returned unwrappable, meaning errors.As and errors.Is will work.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2021-06-08 20:05:54 -07:00
parent d8ba4128b2
commit 7be93a66b9
20 changed files with 50 additions and 49 deletions
+3 -3
View File
@@ -205,7 +205,7 @@ other options are ignored.
var err error
*pair.dest, err = strconv.ParseUint(val, 10, 64)
if err != nil {
return fmt.Errorf("invalid value for %s: %s", pair.opt, err)
return fmt.Errorf("invalid value for %s: %w", pair.opt, err)
}
}
}
@@ -221,7 +221,7 @@ other options are ignored.
var err error
*pair.dest, err = strconv.ParseInt(val, 10, 64)
if err != nil {
return fmt.Errorf("invalid value for %s: %s", pair.opt, err)
return fmt.Errorf("invalid value for %s: %w", pair.opt, err)
}
}
}
@@ -241,7 +241,7 @@ other options are ignored.
if val != "-1" {
v, err = units.RAMInBytes(val)
if err != nil {
return fmt.Errorf("invalid value for %s: %s", pair.opt, err)
return fmt.Errorf("invalid value for %s: %w", pair.opt, err)
}
} else {
v = -1