Skip to content

Commit

Permalink
use %w, not %v, for errors
Browse files Browse the repository at this point in the history
Signed-off-by: Ronald G. Minnich <[email protected]>
  • Loading branch information
rminnich committed Sep 30, 2024
1 parent ed533b5 commit a77cc4e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmds/cpuns/main_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func checkprivate() error {
return err
}
if len(mnts) != 1 {
return fmt.Errorf("got more than 1 mount for /(%v):%v", mnts, os.ErrInvalid)
return fmt.Errorf("got more than 1 mount for /(%v):%w", mnts, os.ErrInvalid)
}
entry := mnts[0]
isShared := strings.Contains(entry.Optional, "shared:1")
Expand Down
2 changes: 1 addition & 1 deletion mount/mount_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func mount(m mounter, fstab string) error {
// we do no further manipulation of opts.
flags, data := parse(opts)
if e := m(dev, where, fstype, flags, data); e != nil {
err = errors.Join(err, fmt.Errorf("Mount(%q, %q, %q, %q=>(%#x, %q)): %v", dev, where, fstype, opts, flags, data, e))
err = errors.Join(err, fmt.Errorf("Mount(%q, %q, %q, %q=>(%#x, %q)): %w", dev, where, fstype, opts, flags, data, e))
}
}
return err
Expand Down
2 changes: 1 addition & 1 deletion mount/mount_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func mount(m mounter, fstab string) error {
// we do no further manipulation of opts.
flags, data := parse(opts)
if e := m(dev, where, fstype, flags, data); e != nil {
err = errors.Join(err, fmt.Errorf("Mount(%q, %q, %q, %q=>(%#x, %q)): %v", dev, where, fstype, opts, flags, data, e))
err = errors.Join(err, fmt.Errorf("Mount(%q, %q, %q, %q=>(%#x, %q)): %w", dev, where, fstype, opts, flags, data, e))
}
}
return err
Expand Down

0 comments on commit a77cc4e

Please sign in to comment.