flock

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package flock provides a portable advisory file lock.

Lock opens or creates a lock file and acquires an exclusive lock on it. The returned release function must be called to unlock and close the file. The lock is advisory: it only serializes callers that also use this package (or otherwise cooperate on the same lock file).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lock

func Lock(path string) (func(), error)

Lock acquires an exclusive advisory lock on path. It creates the lock file with 0600 permissions if it does not exist. The returned release function unlocks and closes the lock file; callers should defer it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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