file

package
v0.71.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package file offers filesystem utils geared towards idempotent operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureSymlink(ctx context.Context, source, target string) (err error)

EnsureSymlink ensures that the symlink is created.

func EnsureSymlinkAbsent added in v0.68.0

func EnsureSymlinkAbsent(ctx context.Context, target string) (err error)

EnsureSymlinkAbsent ensures that the symlink is removed.

Types

type Directories

type Directories []Directory

Directories is a collection of directories.

func (Directories) Ensure

func (ds Directories) Ensure(ctx context.Context) error

Ensure ensures that the directories are created with the desired permissions.

type Directory

type Directory struct {
	Path  string
	Mode  os.FileMode
	Owner string
	Group string
}

Directory represents a desired state for a directory.

func (Directory) Ensure

func (d Directory) Ensure(ctx context.Context) (err error)

Ensure ensures that the directory is created with the desired permissions.

type Path added in v0.68.0

type Path string

Path is a path to a file or directory.

func (Path) EnsureAbsent added in v0.68.0

func (p Path) EnsureAbsent(ctx context.Context, rootPath string) error

EnsureAbsent ensures that the path does not exist and removes it if it does.

type Paths added in v0.68.0

type Paths []Path

Paths is a collection of Path.

func (Paths) EnsureAbsent added in v0.68.0

func (ps Paths) EnsureAbsent(ctx context.Context, rootPath string) error

EnsureAbsent ensures that the paths do not exist and removes them if they do.

type Permission

type Permission struct {
	Path      string
	Owner     string
	Group     string
	Mode      os.FileMode
	Recursive bool
}

Permission represents the desired ownership and mode of a file.

func (Permission) Ensure

func (p Permission) Ensure(ctx context.Context, rootPath string) (err error)

Ensure ensures that the file ownership and mode are set to the desired state.

type Permissions

type Permissions []Permission

Permissions is a collection of Permission.

func (Permissions) Ensure

func (ps Permissions) Ensure(ctx context.Context, rootPath string) error

Ensure ensures that the file ownership and mode are set to the desired state.

Jump to

Keyboard shortcuts

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