fsutil

package
v0.6.76 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fsutil holds small filesystem helpers shared by the daemon's packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyTreeNoClobber

func CopyTreeNoClobber(src, dst string) (int, error)

CopyTreeNoClobber copies src into dst, creating directories and files that don't exist yet and leaving existing ones untouched. Symlinks are recreated as symlinks.

func ReadJSON

func ReadJSON(path string, v any) (bool, error)

ReadJSON reads path into v. It returns false when the file does not exist.

func RemoveIfExists

func RemoveIfExists(path string) (bool, error)

RemoveIfExists removes path (recursively) and ignores a missing path. It returns whether something was removed.

func ResolveWithin

func ResolveWithin(root, p string) (string, error)

ResolveWithin resolves p (absolute, or relative to root; a leading "~" means root) and rejects results that escape root, following symlinks on the longest existing prefix.

func Within

func Within(root, path string) bool

Within reports whether path is root or below it. Both must be clean absolute paths.

func WriteFileAtomic

func WriteFileAtomic(path string, data []byte, perm os.FileMode) error

WriteFileAtomic writes data to a temporary file next to path and renames it into place.

func WriteJSON

func WriteJSON(path string, v any, perm os.FileMode) error

WriteJSON atomically writes v as indented JSON.

Types

This section is empty.

Jump to

Keyboard shortcuts

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