Help us shape the future of Go! Take the 2026 Go Developer Survey

sharedread

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package sharedread opens a file for reading without stopping anyone else from deleting it or renaming another file over it — the latter, on Windows, with a rename that asks for POSIX semantics, as os.Root.Rename does.

On Unix every open already behaves that way. Windows is why this package exists: os.Open leaves FILE_SHARE_DELETE out of the share mode, so while a reader holds a file, a delete of it or a rename over it fails with "The process cannot access the file because it is being used by another process". A design-time store reads off the run loop while the writer on it deletes and replaces records (api/sidecar), and on Windows those two collided.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(name string) (*os.File, error)

Open opens name for reading. Outside Windows an open file never stands in the way of a delete or a rename, so this is os.Open.

func ReadFile

func ReadFile(name string) ([]byte, error)

ReadFile reads the whole file at name, as os.ReadFile does, through Open.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL