fileutil

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtomicWriteFile

func AtomicWriteFile(path string, data []byte, opts AtomicWriteOptions) error

Types

type AtomicWriteOptions

type AtomicWriteOptions struct {
	FileMode         os.FileMode
	DirMode          os.FileMode
	ChmodExistingDir bool
	TempPattern      string
	Rename           func(string, string) error
	SyncDir          bool
}

type FileLock added in v2.3.0

type FileLock struct {
	// contains filtered or unexported fields
}

FileLock holds an exclusive advisory lock on a sibling .lock file.

func LockSiblingFile added in v2.3.0

func LockSiblingFile(path string) (*FileLock, error)

LockSiblingFile acquires an exclusive advisory lock on the sibling file <path>.lock. The returned closer must be released by the caller.

func (*FileLock) Close added in v2.3.0

func (l *FileLock) Close() error

Close releases the lock and closes the underlying file. Unlock failures are returned to the caller after closing the file.

Jump to

Keyboard shortcuts

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