Skip to content

Commit e49f343

Browse files
authored
chore: replace os.(FileMode,PathError) by fs.(...) (#83)
1 parent eccd827 commit e49f343

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

flock.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package flock
1919

2020
import (
2121
"context"
22+
"io/fs"
2223
"os"
2324
"runtime"
2425
"sync"
@@ -35,7 +36,7 @@ func SetFlag(flag int) Option {
3536
}
3637

3738
// SetPermissions sets the OS permissions to set on the file.
38-
func SetPermissions(perm os.FileMode) Option {
39+
func SetPermissions(perm fs.FileMode) Option {
3940
return func(f *Flock) {
4041
f.perm = perm
4142
}
@@ -53,7 +54,7 @@ type Flock struct {
5354
// flag is the flag used to create/open the file.
5455
flag int
5556
// perm is the OS permissions to set on the file.
56-
perm os.FileMode
57+
perm fs.FileMode
5758
}
5859

5960
// New returns a new instance of *Flock. The only parameter
@@ -72,7 +73,7 @@ func New(path string, opts ...Option) *Flock {
7273
f := &Flock{
7374
path: path,
7475
flag: flags,
75-
perm: os.FileMode(0o600),
76+
perm: fs.FileMode(0o600),
7677
}
7778

7879
for _, opt := range opts {

flock_unix_fcntl.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ package flock
2222
import (
2323
"errors"
2424
"io"
25-
"os"
25+
"io/fs"
2626
"sync"
2727
"syscall"
2828

@@ -144,8 +144,7 @@ func (f *Flock) doLock(cmd cmdType, lt lockType, blocking bool) (bool, error) {
144144

145145
if i, dup := inodes[f]; dup && i != ino {
146146
mu.Unlock()
147-
148-
return false, &os.PathError{
147+
return false, &fs.PathError{
149148
Op: lt.String(),
150149
Path: f.Path(),
151150
Err: errors.New("inode for file changed since last Lock or RLock"),

0 commit comments

Comments
 (0)