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:
@@ -101,7 +101,7 @@ following will output a list of processes running in the container:
|
||||
if err == nil {
|
||||
os.Exit(status)
|
||||
}
|
||||
return fmt.Errorf("exec failed: %v", err)
|
||||
return fmt.Errorf("exec failed: %w", err)
|
||||
},
|
||||
SkipArgReorder: true,
|
||||
}
|
||||
@@ -212,13 +212,13 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
|
||||
if len(u) > 1 {
|
||||
gid, err := strconv.Atoi(u[1])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parsing %s as int for gid failed: %v", u[1], err)
|
||||
return nil, fmt.Errorf("parsing %s as int for gid failed: %w", u[1], err)
|
||||
}
|
||||
p.User.GID = uint32(gid)
|
||||
}
|
||||
uid, err := strconv.Atoi(u[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parsing %s as int for uid failed: %v", u[0], err)
|
||||
return nil, fmt.Errorf("parsing %s as int for uid failed: %w", u[0], err)
|
||||
}
|
||||
p.User.UID = uint32(uid)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user