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/fat32/fat32.go b/osbase/fat32/fat32.go
index a0b8414..e0d460f 100644
--- a/osbase/fat32/fat32.go
+++ b/osbase/fat32/fat32.go
@@ -397,7 +397,7 @@
for _, i := range p.orderedInodes {
if err := i.writeData(wb, bs.Label); err != nil {
- return fmt.Errorf("failed to write inode %q: %v", i.Name, err)
+ return fmt.Errorf("failed to write inode %q: %w", i.Name, err)
}
if err := wb.FinishBlock(int64(opts.BlockSize)*int64(bs.BlocksPerCluster), false); err != nil {
return err
@@ -423,7 +423,7 @@
if opts.ID == 0 {
var buf [4]byte
if _, err := rand.Read(buf[:]); err != nil {
- return nil, nil, nil, fmt.Errorf("failed to assign random FAT ID: %v", err)
+ return nil, nil, nil, fmt.Errorf("failed to assign random FAT ID: %w", err)
}
opts.ID = binary.BigEndian.Uint32(buf[:])
}