filesystem

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default permissions used for directories
	DefaultDirectoryMode os.FileMode = 0700
)

Variables

This section is empty.

Functions

func AtomicWriteFile

func AtomicWriteFile(
	path string,
	perm os.FileMode,
	write func(io.Writer) error,
) error

AtomicWriteFile safely replaces a file using a temporary file and an atomic rename.

The temporary file is created in the destination directory to ensure the rename operation is atomic on the same filesystem.

On success, the destination file is either completely replaced or left untouched if an error occurs.

func CreateDirectory added in v0.5.3

func CreateDirectory(path string) (created bool, err error)

EnsureDirectory makes sure a directory exists.

If the directory does not exist, it is created using the default GitBack directory permissions.

Returns:

created == true

when the directory had to be created.

The returned error always includes the directory path for easier troubleshooting.

Types

This section is empty.

Jump to

Keyboard shortcuts

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