filesystem

package
v0.0.0-...-bc03976 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenameIfExists

func RenameIfExists(a, b string) (renamed bool, err error)

Renames the file "a" to "b" iff "a" exists. It returns "true" and no error, if rename were successful. It returns "false" and no error, if the file "a" does not exist. It returns "false" and an error, if rename failed.

Types

type MockFile

type MockFile struct {
	MockName    string
	MockIsDir   bool
	MockType    fs.FileMode
	MockInfo    fs.FileInfo
	MockInfoErr error
}

MockFile is an implementation of fs.File for unit testing.

func (MockFile) Info

func (m MockFile) Info() (fs.FileInfo, error)

func (MockFile) IsDir

func (m MockFile) IsDir() bool

func (MockFile) Name

func (m MockFile) Name() string

func (MockFile) Type

func (m MockFile) Type() fs.FileMode

type Reader

type Reader interface {
	// ReadDir reads a given directory.
	// Returns the files in the directory.
	ReadDir(string) ([]fs.DirEntry, error)
}

Reader is an interface for reading the filesystem.

func NewReader

func NewReader() Reader

NewReader returns an instance of Reader

Directories

Path Synopsis
Package filesystemmock is a generated GoMock package.
Package filesystemmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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