func (f *Flock) Unlock() error {
	f.m.Lock()
	defer f.m.Unlock()
	if (!f.l && !f.r) || f.fh == nil {
		return nil
	}
	if _, errNo := unlockFileEx(syscall.Handle(f.fh.Fd()), 0, 1, 0, &syscall.Overlapped{}); errNo > 0 {
		return errNo
	}
	f.fh.Close()
	f.l = false
	f.r = false
	f.fh = nil
	return nil
}
Unlock is a function to unlock the file. This file takes a RW-mutex lock, so
while it is running the Locked() and RLocked() functions will be blocked.

This function short-circuits if we are unlocked already. If not, it calls
UnlockFileEx() on the file and closes the file descriptor. It does not remove
the file from disk. It's up to your application to do.
package flock
import (
	"syscall"
)
const ErrorLockViolation syscall.Errno = 0x21  
func (f *Flock) Lock() error {
	return f.lock(&f.l, winLockfileExclusiveLock)
}
func (f *Flock) RLock() error {
	return f.lock(&f.r, winLockfileSharedLock)
}
func (f *Flock) lock(locked *bool, flag uint32) error {
	f.m.Lock()
	defer f.m.Unlock()
	if *locked {
		return nil
	}
	if f.fh == nil {
		if err := f.setFh(); err != nil {
			return err
		}
	}
	if _, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag, 0, 1, 0, &syscall.Overlapped{}); errNo > 0 {
		return errNo
	}
	*locked = true
	return nil
}