walk

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Overview

Package walk provides deterministic, filtered directory traversal.

Index

Constants

This section is empty.

Variables

View Source
var ErrWalkTruncated = errors.New("walk truncated")

ErrWalkTruncated reports that a configured visit or result cap stopped traversal.

Functions

func Walk

func Walk(ctx context.Context, filter *Filter, callback func(Entry) error) error

Walk traverses descendants of Filter.Root in lexical order. Symlinks are reported but never descended, including when FollowSymlinks is true.

Types

type Entry

type Entry struct {
	Path      string
	IsDir     bool
	IsSymlink bool
	Size      int64
	ModTime   time.Time
	Mode      fs.FileMode
}

Entry is one callback-visible descendant of the walk root.

type Filter

type Filter struct {
	Root             *workspace.Root
	WarningSink      warning.Warner
	IncludeGlobs     []string
	ExcludeGlobs     []string
	SkipHidden       bool
	SkipVCS          bool
	RespectGitignore bool
	FollowSymlinks   bool
	MaxDepth         int
	MaxVisited       int
	MaxResults       int
}

Filter controls directory traversal. A zero visit or result cap selects the package default. A negative depth is unlimited; depth zero visits only the root.

Jump to

Keyboard shortcuts

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