We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1f47197 + b879c1e commit 37740a3Copy full SHA for 37740a3
pkg/internal/filesystem/lock.go
@@ -51,7 +51,10 @@ func ReadOnlyLock(path string) (file *os.File, err error) {
51
func commonlock(path string, mode lockType) (file *os.File, err error) {
52
defer func() {
53
if err != nil {
54
- err = errors.Join(ErrLockFail, err, file.Close())
+ err = errors.Join(ErrLockFail, err)
55
+ if file != nil {
56
+ err = errors.Join(err, file.Close())
57
+ }
58
}
59
}()
60
0 commit comments