dotlk_other.go

 1//go:build !unix
 2
 3package dotlk
 4
 5import "os"
 6
 7// TryLock returns nil if it acquired the lock,
 8// fs.ErrExist if another process has the lock.
 9func TryLock(name string) error {
10	f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666)
11	f.Close()
12	return err
13}