Documentation
¶
Overview ¶
Package fileset handles file path resolution and glob expansion.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoPatterns = errors.New("fileset: no patterns provided")
ErrNoPatterns indicates that Resolve was invoked without any glob patterns.
Functions ¶
This section is empty.
Types ¶
type MemoryResolver ¶
type MemoryResolver struct {
// contains filtered or unexported fields
}
MemoryResolver implements Resolver for testing without filesystem.
func NewMemoryResolver ¶
func NewMemoryResolver(base string, files map[string][]byte) *MemoryResolver
NewMemoryResolver creates a new MemoryResolver with the given files. Files should be a map of relative paths to content.
func (*MemoryResolver) AddFile ¶
func (m *MemoryResolver) AddFile(path string, content []byte)
AddFile adds a file to the resolver.
func (*MemoryResolver) FileCount ¶
func (m *MemoryResolver) FileCount() int
FileCount returns the number of files.
func (*MemoryResolver) ReadFile ¶
func (m *MemoryResolver) ReadFile(path string) ([]byte, error)
ReadFile returns the content of an in-memory file.
func (*MemoryResolver) RemoveFile ¶
func (m *MemoryResolver) RemoveFile(path string)
RemoveFile removes a file from the resolver.
type NoMatchError ¶
type NoMatchError struct {
Patterns []string
}
NoMatchError describes which patterns failed to yield any results.
func (NoMatchError) Error ¶
func (e NoMatchError) Error() string
Error implements the error interface.
type PatternError ¶
PatternError wraps syntax issues reported while evaluating a glob pattern.
func (PatternError) Error ¶
func (e PatternError) Error() string
Error implements the error interface.
func (PatternError) Unwrap ¶
func (e PatternError) Unwrap() error
Unwrap returns the underlying error.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver resolves glob patterns against an fs.FS and rewrites the discovered paths using a join function for deterministic, de-duplicated results.
func NewOSResolver ¶
NewOSResolver constructs a Resolver rooted at base that returns absolute OS paths for each match.
func NewResolver ¶
NewResolver constructs a Resolver against the provided filesystem without any path rewriting, preserving the original match names. Useful for tests.