Version: v1.8.2 Latest Latest

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

Go to latest
Published: Nov 4, 2017 License: Apache-2.0 Imports: 3 Imported by: 0



Package flock provides portable file locking. It is essentially ripped out from the code of github.com/syndtr/goleveldb. Strange enough that the standard library does not provide this functionality. Once this package has proven to work as expected, we should probably turn it into a separate general purpose package for humanity.



This section is empty.


This section is empty.


This section is empty.


type Releaser

type Releaser interface {
	Release() error

Releaser provides the Release method to release a file lock.

func New

func New(fileName string) (r Releaser, existed bool, err error)

New locks the file with the provided name. If the file does not exist, it is created. The returned Releaser is used to release the lock. existed is true if the file to lock already existed. A non-nil error is returned if the locking has failed. Neither this function nor the returned Releaser is goroutine-safe.

Jump to

Keyboard shortcuts

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