pathspec

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pathspec evaluates lexical path filters without filesystem access.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasPathPrefix

func HasPathPrefix(pathValue, prefix string) bool

HasPathPrefix reports whether path is the same as prefix or is nested under it. Both inputs are normalized to slash-separated clean relative paths. @intent compare include path scopes after normalization so callers can test path containment reliably.

func IsRegexPattern

func IsRegexPattern(pat string) bool

IsRegexPattern detects whether a pattern uses regex syntax rather than glob. Checks for anchors ($) and escape sequences (\.) that are regex-specific. @intent glob과 정규표현식 패턴을 구분해 적절한 매칭 엔진을 선택한다.

func MatchExcludes

func MatchExcludes(patterns []string, relPath string) bool

MatchExcludes reports whether relPath matches any of the given exclude patterns.

Pattern forms:

  • Path prefix: "vendor" or "internal/legacy" — excludes everything under that path.
  • Filename glob: "*.pb.go" — matches files by name anywhere in the tree. Patterns without "/" are applied against the base file name only.
  • Full-path glob: "internal/gen/*.go" — matched against the full slash-separated relPath.

relPath should be relative to the project root. OS-specific separators are normalized to forward slashes before matching. @intent 설정과 CLI에서 받은 제외 패턴을 상대 경로에 일관되게 적용한다. @domainRule 슬래시가 없는 패턴은 파일 basename에만 매칭한다.

func MatchIncludePaths

func MatchIncludePaths(relPath string, includePaths []string) bool

MatchIncludePaths reports whether relPath falls inside or is an ancestor of any configured include path. @intent let walkers prune directories that lie outside user-selected include scopes while still descending into ancestors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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