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

pathutil

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalSymlinksCached added in v1.15.0

func EvalSymlinksCached(ctx context.Context, path string) (string, error)

func Excluded added in v1.7.0

func Excluded(filePath string, ignorePaths, onlyPaths []string) bool

Excluded reports whether filePath should be dropped given ignore-paths and only-paths lists. A file is excluded if it matches any ignorePaths pattern; otherwise, when onlyPaths is non-empty, it is excluded unless it matches one of them. Patterns use MatchesPath semantics.

func ExcludedAny added in v1.20.0

func ExcludedAny(paths []string, ignored, inScope func(string) bool, restricted bool) bool

ExcludedAny reports whether ignore-paths or only-paths leave out a file known by several paths, such as a file inside a chart archive and the declaration it is reported at: a path matched by an ignore drops the file, and when restricted, a path in scope keeps it. ignored and inScope decide one path.

func MatchesPath

func MatchesPath(pattern, filePath string) bool

MatchesPath reports whether filePath is covered by pattern. pattern may be a literal path, a directory prefix, a single-star glob (*, ?, [...]), or a double-star glob (**) where ** matches zero or more path segments. Both arguments are normalized to forward slashes for OS-independent behavior, and cleaned, so "./app" and "app/" name the same directory as "app".

func PathEscapesDir added in v1.15.0

func PathEscapesDir(rel string) bool

func WithResolvedPathCache added in v1.15.0

func WithResolvedPathCache(ctx context.Context) context.Context

WithResolvedPathCache attaches a scan-scoped EvalSymlinks cache to ctx. Nested calls reuse the existing cache so graph walking and evaluation share hits.

Types

This section is empty.

Jump to

Keyboard shortcuts

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