filewalker

package
v3.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSkipFile = errors.New("skip file")

ErrSkipFile is returned by hooks to signal that the file should be skipped.

Functions

func Preposterous

func Preposterous(path string, fileIndex *index.FileIndex, preHook hooks.OpenInputFileHook, postHook hooks.CloseInputFileHook, fn func() stat.Result) (stat.Result, error)

Preposterous runs a function on a file, and handles open and close input file hooks.

func WithFollowSymlinks(followSymlinks bool) func(*FileWalker)

func WithFs

func WithFs(fs afero.Fs) func(*FileWalker)

func WithRecursive

func WithRecursive(recursive bool) func(*FileWalker)

func WithSuffixes

func WithSuffixes(suffixes []string) func(*FileWalker)

Types

type FileWalker

type FileWalker struct {
	Recursive      bool
	FollowSymlinks bool
	Suffixes       []string
	Fs             afero.Fs
	// contains filtered or unexported fields
}

func New

func New(options ...func(*FileWalker)) *FileWalker

func (*FileWalker) Walk

func (fw *FileWalker) Walk(path string, walkFn func(fs afero.Fs, path string, err error) error) error

type StringSet

type StringSet map[string]struct{}

StringSet is a set of strings

func NewStringSet

func NewStringSet() StringSet

NewStringSet creates a new StringSet

func (StringSet) Add

func (s StringSet) Add(path string)

Add adds a string to the set

func (StringSet) Contains

func (s StringSet) Contains(path string) bool

Contains checks if a string is in the set

Jump to

Keyboard shortcuts

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