Skip to content

Commit

Permalink
pkg/lockfile: no else needed after panic
Browse files Browse the repository at this point in the history
Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Sep 19, 2024
1 parent 1959722 commit 1ac1730
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/lockfile/lockfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ func GetROLockfile(path string) (Locker, error) {
func (l *LockFile) Lock() {
if l.ro {
panic("can't take write lock on read-only lock file")
} else {
l.lock(writeLock)
}
l.lock(writeLock)
}

// RLock locks the lockfile as a reader.
Expand All @@ -142,9 +141,8 @@ func (l *LockFile) RLock() {
func (l *LockFile) TryLock() error {
if l.ro {
panic("can't take write lock on read-only lock file")
} else {
return l.tryLock(writeLock)
}
return l.tryLock(writeLock)
}

// TryRLock attempts to lock the lockfile as a reader.
Expand Down

0 comments on commit 1ac1730

Please sign in to comment.