From 2b170e716e655b2f2f8ef182844be1154aa7a82c Mon Sep 17 00:00:00 2001 From: Daniel Lublin Date: Sun, 21 Jul 2024 19:54:23 +0200 Subject: [PATCH] Wrap errors, not Unwrap Fixes https://github.com/diskfs/go-diskfs/issues/237 --- diskfs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diskfs.go b/diskfs.go index f910e45b..f0952a09 100644 --- a/diskfs.go +++ b/diskfs.go @@ -344,11 +344,11 @@ func Create(device string, size int64, _ Format, sectorSize SectorSize) (*disk.D } f, err := os.OpenFile(device, os.O_RDWR|os.O_EXCL|os.O_CREATE, 0o666) if err != nil { - return nil, fmt.Errorf("could not create device %s: %v", device, errors.Unwrap(err)) + return nil, fmt.Errorf("could not create device %s: %w", device, err) } err = os.Truncate(device, size) if err != nil { - return nil, fmt.Errorf("could not expand device %s to size %d: %v", device, size, errors.Unwrap(err)) + return nil, fmt.Errorf("could not expand device %s to size %d: %w", device, size, err) } // return our disk return initDisk(f, ReadWriteExclusive, sectorSize)