Skip to content

Commit 39e6ff9

Browse files
committed
fix(flock): add Windows stub for cross-platform build
1 parent 2e9bf30 commit 39e6ff9

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

internal/flock/flock_windows.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//go:build windows
2+
3+
package flock
4+
5+
import (
6+
"fmt"
7+
"os"
8+
)
9+
10+
func Lock(path string) (func(), error) {
11+
f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0o644)
12+
if err != nil {
13+
return nil, fmt.Errorf("open lock file: %w", err)
14+
}
15+
16+
unlock := func() {
17+
f.Close()
18+
}
19+
20+
return unlock, nil
21+
}

0 commit comments

Comments
 (0)