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

filelock

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package filelock provides cross-platform file locking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lock

func Lock(f *os.File) error

Lock places an exclusive advisory lock on the given file. It blocks until the lock is acquired.

func TryLock

func TryLock(f *os.File) (bool, error)

TryLock places an exclusive advisory lock on the given file without waiting. It reports false and a nil error when the lock is already held through another open file (another process, or another descriptor or handle of this one).

func TryReadLock

func TryReadLock(f *os.File) (bool, error)

TryReadLock acquires a shared lock without waiting for a writer.

func Unlock

func Unlock(f *os.File) error

Unlock releases the advisory lock on the given file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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