pathmatch

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizePath

func NormalizePath(p string) string

NormalizePath normalizes a slash-separated path for glob matching.

Types

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

Matcher matches paths against a list of compiled glob patterns.

func NewMatcher

func NewMatcher(patterns []string) (*Matcher, error)

NewMatcher compiles a list of glob patterns into a Matcher.

func (*Matcher) CanMatchDescendant

func (m *Matcher) CanMatchDescendant(dir string) bool

CanMatchDescendant reports whether any pattern can match under dir.

func (*Matcher) Match

func (m *Matcher) Match(path string) bool

Match reports whether any pattern in the matcher matches the full path.

type Pattern

type Pattern struct {
	// contains filtered or unexported fields
}

Pattern is a compiled glob pattern that can match full paths.

func Compile

func Compile(pattern string) (*Pattern, error)

Compile parses a glob pattern into a reusable compiled Pattern.

func (*Pattern) CanMatchDescendant

func (p *Pattern) CanMatchDescendant(dir string) bool

CanMatchDescendant reports whether the pattern can match any descendant of dir.

func (*Pattern) Match

func (p *Pattern) Match(path string) bool

Match reports whether the pattern matches the full path.

Jump to

Keyboard shortcuts

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