fs

package
v0.0.0-...-d74ee84 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lstat

func Lstat(path string, stat *syscall.Stat_t) error

Lstat see syscall.Lstat

func Mock

func Mock(mock Interface)

Mock is used to switch out the filesystem for a mock.

func Open

func Open(path string) (io.ReadWriteCloser, error)

Open see os.Open

func ReadDir

func ReadDir(path string) ([]os.FileInfo, error)

ReadDir see ioutil.ReadDir

func ReadDirCount

func ReadDirCount(path string) (int, error)

ReadDirCount is an optimized way to call len(ReadDirNames)

func ReadDirNames

func ReadDirNames(path string) ([]string, error)

ReadDirNames see os.File.ReadDirNames

func ReadFile

func ReadFile(path string) ([]byte, error)

ReadFile see ioutil.ReadFile

func Restore

func Restore()

Restore puts back the real filesystem.

func Stat

func Stat(path string, stat *syscall.Stat_t) error

Stat see syscall.Stat

Types

type Interface

type Interface interface {
	ReadDir(string) ([]os.FileInfo, error)
	ReadDirNames(string) ([]string, error)
	ReadDirCount(string) (int, error)
	ReadFile(string) ([]byte, error)
	Lstat(string, *syscall.Stat_t) error
	Stat(string, *syscall.Stat_t) error
	Open(string) (io.ReadWriteCloser, error)
}

Interface is the filesystem interface type.

Jump to

Keyboard shortcuts

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