treewide: fix %v in cases where we should use %w
We should always use %w when using fmt.Errorf as you can use error.Is to
compare the underlying error. When printing an error the use of %w is
wrong and should be replaced with %v.
Change-Id: I741111bd91dcee4099144d2ecaffa879fdbb34a2
Reviewed-on: https://review.monogon.dev/c/monogon/+/2993
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/osbase/fsquota/fsxattrs/fsxattrs.go b/osbase/fsquota/fsxattrs/fsxattrs.go
index 135b886..8c94657 100644
--- a/osbase/fsquota/fsxattrs/fsxattrs.go
+++ b/osbase/fsquota/fsxattrs/fsxattrs.go
@@ -67,7 +67,7 @@
var attrs FSXAttrs
_, _, errno := unix.Syscall(unix.SYS_IOCTL, file.Fd(), FS_IOC_FSGETXATTR, uintptr(unsafe.Pointer(&attrs)))
if errno != 0 {
- return nil, fmt.Errorf("failed to execute getFSXAttrs: %v", errno)
+ return nil, fmt.Errorf("failed to execute getFSXAttrs: %w", errno)
}
return &attrs, nil
}
@@ -75,7 +75,7 @@
func Set(file *os.File, attrs *FSXAttrs) error {
_, _, errno := unix.Syscall(unix.SYS_IOCTL, file.Fd(), FS_IOC_FSSETXATTR, uintptr(unsafe.Pointer(attrs)))
if errno != 0 {
- return fmt.Errorf("failed to execute setFSXAttrs: %v", errno)
+ return fmt.Errorf("failed to execute setFSXAttrs: %w", errno)
}
return nil
}