//go:build windows package version import ( "os" "golang.org/x/sys/windows" ) // The helper polls while its parent atomically publishes the helper identity. // A default Go read handle denies rename/delete on Windows, making that normal // handshake intermittently fail. Retain the old inode for this read while // allowing the next journal version to replace its pathname. func openUpdateJournal(path string) (*os.File, error) { name, err := windows.UTF16PtrFromString(path) if err != nil { return nil, err } handle, err := windows.CreateFile(name, windows.GENERIC_READ, windows.FILE_SHARE_READ|windows.FILE_SHARE_WRITE|windows.FILE_SHARE_DELETE, nil, windows.OPEN_EXISTING, windows.FILE_ATTRIBUTE_NORMAL, 0) if err != nil { return nil, &os.PathError{Op: "open", Path: path, Err: err} } return os.NewFile(uintptr(handle), path), nil }