From 2c63b8439bbdc09203ea394ad2cf9352830861f0 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Sat, 10 Sep 2022 07:40:39 -0400 Subject: Fix stutters Podman adds an Error: to every error message. So starting an error message with "error" ends up being reported to the user as Error: error ... This patch removes the stutter. Also ioutil.ReadFile errors report the Path, so wrapping the err message with the path causes a stutter. Signed-off-by: Daniel J Walsh --- libpod/lock/file/file_lock.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libpod/lock') diff --git a/libpod/lock/file/file_lock.go b/libpod/lock/file/file_lock.go index 1379e690a..90ed7cd8c 100644 --- a/libpod/lock/file/file_lock.go +++ b/libpod/lock/file/file_lock.go @@ -103,7 +103,7 @@ func (locks *FileLocks) AllocateGivenLock(lck uint32) error { f, err := os.OpenFile(locks.getLockPath(lck), os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) if err != nil { - return fmt.Errorf("error creating lock %d: %w", lck, err) + return fmt.Errorf("creating lock %d: %w", lck, err) } f.Close() @@ -131,7 +131,7 @@ func (locks *FileLocks) DeallocateAllLocks() error { } files, err := ioutil.ReadDir(locks.lockPath) if err != nil { - return fmt.Errorf("error reading directory %s: %w", locks.lockPath, err) + return fmt.Errorf("reading directory %s: %w", locks.lockPath, err) } var lastErr error for _, f := range files { @@ -153,7 +153,7 @@ func (locks *FileLocks) LockFileLock(lck uint32) error { l, err := storage.GetLockfile(locks.getLockPath(lck)) if err != nil { - return fmt.Errorf("error acquiring lock: %w", err) + return fmt.Errorf("acquiring lock: %w", err) } l.Lock() @@ -167,7 +167,7 @@ func (locks *FileLocks) UnlockFileLock(lck uint32) error { } l, err := storage.GetLockfile(locks.getLockPath(lck)) if err != nil { - return fmt.Errorf("error acquiring lock: %w", err) + return fmt.Errorf("acquiring lock: %w", err) } l.Unlock() -- cgit v1.2.3-54-g00ecf