mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
*: 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user