Help us shape the future of Go! Take the 2026 Go Developer Survey

pathglob

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pathglob provides deterministic matching for slash-separated paths.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyPattern     = errors.New("path glob is empty")
	ErrUnsupportedBrace = errors.New("path glob brace expansion is unsupported")
)

Functions

func MatchString

func MatchString(pattern, value string) bool

MatchString applies the shared *, ?, and backslash-escape matcher to an arbitrary string. Unlike Matcher, slash has no special meaning.

func SplitList

func SplitList(value string) []string

SplitList splits a comma-separated pattern list, trimming and omitting empty items.

Types

type Matcher

type Matcher interface {
	Match(relPath string) bool
	Patterns() []string
}

Matcher matches slash-separated, root-relative paths.

func Compile

func Compile(patterns []string) (Matcher, []error)

Compile compiles patterns and returns a matcher containing every valid rule. Invalid rules are omitted and returned in input order.

func CompileOne

func CompileOne(pattern string) (Matcher, error)

CompileOne compiles one pattern.

Jump to

Keyboard shortcuts

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