fs

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package fs provides error constructors for filesystem operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoundaryViolation

func BoundaryViolation(cause error) error

BoundaryViolation wraps a boundary validation error with a hint to use --allow-outside-cwd.

Parameters:

  • cause: the underlying validation error

Returns:

  • error: "<cause>\nUse --allow-outside-cwd to override this check"

func CreateDir

func CreateDir(dir string, cause error) error

CreateDir wraps a directory creation failure.

Parameters:

  • dir: the directory path that could not be created
  • cause: the underlying error

Returns:

  • error: "failed to create directory <dir>: <cause>"

func DirNotFound

func DirNotFound(dir string) error

DirNotFound returns an error when a directory does not exist.

Parameters:

  • dir: the missing directory path.

Returns:

  • error: "directory not found: <dir>"

func FileAmend

func FileAmend(path string, cause error) error

FileAmend wraps a failure to amend an existing file.

Parameters:

  • path: file path that could not be amended
  • cause: the underlying OS error

Returns:

  • error: "failed to amend <path>: <cause>"

func FileRead

func FileRead(path string, cause error) error

FileRead wraps a file read failure with path context.

Parameters:

  • path: file path that could not be read.
  • cause: the underlying OS error.

Returns:

  • error: "failed to read <path>: <cause>"

func FileUpdate

func FileUpdate(path string, cause error) error

FileUpdate wraps a failure to update a file.

Parameters:

  • path: file path that could not be updated
  • cause: the underlying OS error

Returns:

  • error: "failed to update <path>: <cause>"

func FileWrite

func FileWrite(path string, cause error) error

FileWrite wraps a file write failure.

Parameters:

  • path: file path that could not be written.
  • cause: the underlying OS error.

Returns:

  • error: "failed to write <path>: <cause>"

func Mkdir

func Mkdir(desc string, cause error) error

Mkdir wraps a directory creation failure.

Parameters:

  • desc: human description of the directory (e.g. "journal directory").
  • cause: the underlying OS error.

Returns:

  • error: "failed to create <desc>: <cause>"

func NoInput

func NoInput() error

NoInput returns an error for missing stdin input.

Returns:

  • error: "no input received"

func NotDirectory

func NotDirectory(path string) error

NotDirectory returns an error when a path is not a directory.

Parameters:

  • path: the path.

Returns:

  • error: "<path> is not a directory"

func OpenFile

func OpenFile(path string, cause error) error

OpenFile wraps a file open failure.

Parameters:

  • path: the file path.
  • cause: the underlying OS error.

Returns:

  • error: "open <path>: <cause>"

func PathEscapesBase

func PathEscapesBase(filename string) error

PathEscapesBase returns an error when a path escapes its base directory.

Parameters:

  • filename: the offending filename

Returns:

  • error: "path escapes base directory: <filename>"

func ReadDir

func ReadDir(desc string, cause error) error

ReadDir wraps a directory read failure.

Parameters:

  • desc: human description of the directory (e.g. "journal directory").
  • cause: the underlying OS error.

Returns:

  • error: "read <desc>: <cause>"

func ReadDirectory

func ReadDirectory(path string, cause error) error

ReadDirectory wraps a directory read failure.

Parameters:

  • path: the directory path.
  • cause: the underlying OS error.

Returns:

  • error: "read directory <path>: <cause>"

func ReadFile

func ReadFile(cause error) error

ReadFile wraps a file read failure.

Parameters:

  • cause: the underlying read error.

Returns:

  • error: "read file: <cause>"

func ReadInput

func ReadInput(cause error) error

ReadInput wraps a failure to read user input.

Parameters:

  • cause: the underlying error from the read operation.

Returns:

  • error: "failed to read input: <cause>"

func ReadInputStream

func ReadInputStream(cause error) error

ReadInputStream wraps a failure to read from the input stream.

Parameters:

  • cause: the underlying read error.

Returns:

  • error: "error reading input: <cause>"

func RefuseSystemPath

func RefuseSystemPath(path string) error

RefuseSystemPath returns an error when access to a system path is refused.

Parameters:

  • path: the system path being refused

Returns:

  • error: "refusing to access system path: <path>"

func RefuseSystemPathRoot

func RefuseSystemPathRoot() error

RefuseSystemPathRoot returns an error when access to "/" is refused.

Returns:

  • error: "refusing to access system path: /"

func ResolveBase

func ResolveBase(cause error) error

ResolveBase wraps a failure to resolve a base directory path.

Parameters:

  • cause: the underlying resolution error

Returns:

  • error: "resolve base: <cause>"

func ResolvePath

func ResolvePath(cause error) error

ResolvePath wraps a failure to resolve a file path.

Parameters:

  • cause: the underlying resolution error

Returns:

  • error: "resolve path: <cause>"

func StatPath

func StatPath(path string, cause error) error

StatPath wraps a stat failure.

Parameters:

  • path: the path that failed.
  • cause: the underlying OS error.

Returns:

  • error: "stat <path>: <cause>"

func WorkingDirectory

func WorkingDirectory(cause error) error

WorkingDirectory wraps a failure to determine the working directory.

Parameters:

  • cause: the underlying error from os.Getwd

Returns:

  • error: "failed to get working directory: <cause>"

func WriteFileFailed

func WriteFileFailed(cause error) error

WriteFileFailed wraps a file write failure.

Parameters:

  • cause: the underlying write error.

Returns:

  • error: "write file: <cause>"

func WriteMerged

func WriteMerged(path string, cause error) error

WriteMerged wraps a failure to write a merged file.

Parameters:

  • path: file path that could not be written
  • cause: the underlying OS error

Returns:

  • error: "failed to write merged <path>: <cause>"

Types

This section is empty.

Jump to

Keyboard shortcuts

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