code: func NewLock(path string, lockType LockType) (*FileLock, error) {
  	l := &FileLock{path: path, fd: -1}
  
  	mode := syscall.O_RDONLY | syscall.O_CLOEXEC
  	if lockType == Dir {
  		mode |= syscall.O_DIRECTORY
  	}
  	lfd, err := syscall.Open(l.path, mode, 0)
  	if err != nil {
  		if err == syscall.ENOENT {
  			err = ErrNotExist
  		} else if err == syscall.EACCES {
  			err = ErrPermission
  		}
  		return nil, err
  	}
  	l.fd = lfd
  
  	var stat syscall.Stat_t
  	err = syscall.Fstat(lfd, &stat)
  	if err != nil {
  		return nil, err
  	}
  	// Check if the file is a regular file
  	if lockType == RegFile && !(stat.Mode&syscall.S_IFMT == syscall.S_IFREG) {
  		return nil, ErrNotRegular
  	}
  
  	return l, nil
  }
docs: // NewLock opens a new lock on a file without acquisition