Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dirent ¶ added in v4.0.2
type Dirent struct { // Path is the complete path to the directory entry (including both // directory and basename) Path string // Type is the type bits of the file mode of this entry. Type os.FileMode // Inode is the file system inode number for this entry. Inode uint64 }
Dirent represents a file system directory entry (a file or a directory), providing information about the entry's path, type and inode.
type ErrorCallback ¶
ErrorCallback is a callback function you supply Walker.Walk(), and it will be provided problematic paths encountered during the walk.
type Files ¶
type Files struct { Paths []string // contains filtered or unexported fields }
Files represents a collection of output files that can be written to in a round-robin.
func NewFiles ¶
NewFiles returns a Files that has a WritePaths method that will return a PathsCallback function suitable for passing to New().
This creates n output files in outDir, and writes the walk paths to those files 1 per line in a round-robin.
The output file paths can be found in the Paths property.
Be sure to Close() after you've finished walking.
func (*Files) WritePaths ¶
func (f *Files) WritePaths() PathCallback
WritePaths returns a PathCallback function suitable for passing to New().
Paths are written 1 per line to our output files in a round-robin.
It will terminate the walk if writes to our output files fail.
type PathCallback ¶
PathCallback is a callback used by Walker.Walk() that receives a directory entry containing the path, inode and file type each time it's called. It should only return an error if you can no longer cope with receiving more paths, and wish to terminate the Walk.
type Walker ¶
type Walker struct {
// contains filtered or unexported fields
}
Walker can be used to quickly walk a filesystem to just see what paths there are on it.
func New ¶
func New(cb PathCallback, includDirs, ignoreSymlinks bool) *Walker
New creates a new Walker that can Walk() a filesystem and send all the encountered paths to the given PathCallback.
Set includeDirs to true to have your PathCallback receive directory paths in addition to file paths.
Set ignoreSymlinks to true to have symlinks not be sent do your PathCallback.
func (*Walker) Walk ¶
func (w *Walker) Walk(dir string, cb ErrorCallback) error
Walk will discover all the paths nested under the given dir, and send them to our PathCallback.
The given error callback will be called every time there's an error handling a file during the walk. Errors writing to an output file will result in the walk terminating early and this method returning the error; other kinds of errors will mean the path isn't output, but the walk will continue and this method won't return an error.
type WriteError ¶
type WriteError struct {
Err error
}
WriteError is an error received when trying to write strings to disk.
func (*WriteError) Error ¶
func (e *WriteError) Error() string
func (*WriteError) Unwrap ¶
func (e *WriteError) Unwrap() error