You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the lock fails because of some reason other than it being already
locked, it would be nice to be able to tell that other than
with string comparison and checking .Temporary().
This would make it easer to implement blocking locks
based around a backoff-and-retry strategy (you probably
don't want to retry if you're getting EPERM for example).
For example (as an addition to the API):
// LockedError records an error that occurs when
// a file is already locked.
type LockedError struct {
File string
}
func (e *LockedError) Error() string {
return fmt.Sprintf("file %q already locked", e.File)
}
// IsLocked reports whether the error is due to
// a file being already locked.
func IsLocked(err error) bool {
_, ok := err.(*LockedError)
return ok
}
The text was updated successfully, but these errors were encountered:
If the lock fails because of some reason other than it being already
locked, it would be nice to be able to tell that other than
with string comparison and checking .Temporary().
This would make it easer to implement blocking locks
based around a backoff-and-retry strategy (you probably
don't want to retry if you're getting EPERM for example).
For example (as an addition to the API):
The text was updated successfully, but these errors were encountered: