pathglob

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package pathglob matches slash-separated relative paths against the glob patterns hook matchers and scoped rules share, so one pattern means the same thing in both.

The syntax follows the patterns Claude Code rules, Cursor rules, and GitHub Copilot instructions document:

  • `*` matches any run of characters inside one path segment.
  • `**` as a whole segment matches zero or more segments, so `**/*.go` matches `main.go` and `cmd/app/main.go`.
  • `?` matches one character other than `/`.
  • `[abc]`, `[a-z]`, and `[!abc]` or `[^abc]` match one character from, or not from, the set. They never match `/`.
  • `{a,b}` matches either alternative, and alternatives may nest.
  • `\` makes the next character literal.

A brace group with no comma, such as `{a}`, is literal text.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(pattern string) (*regexp.Regexp, error)

Compile translates pattern into an anchored regular expression.

A pattern with an unclosed `[` or `{`, or a trailing `\`, fails with commerr.ErrValidationFailed.

func Match

func Match(pattern string, path string) bool

Match reports whether the slash-separated relative path matches pattern. An invalid pattern matches nothing.

func Validate

func Validate(pattern string) error

Validate reports whether pattern compiles.

Types

This section is empty.

Jump to

Keyboard shortcuts

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