scanner

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIgnoreMatcher added in v0.3.1

func NewIgnoreMatcher(root string, opts ScanOptions) (func(relPath string) bool, error)

NewIgnoreMatcher returns a predicate reporting whether a project-relative path would be EXCLUDED by the active ignore rules — the same rules ScanDirOpts applies: .docgraphignore always, and .gitignore unless opts.NoGitignore, at the root and in every nested directory. It collects the ignore files once (a cheap walk that reads only ignore files, skipping the usual vendored/VCS dirs); the returned closure then classifies any number of paths.

This is the safe signal for the serve-time delete-reconcile: a file that is still on disk but now matches an ignore rule is unambiguously meant to be excluded, so pruning it is correct. That is strictly narrower than raw scan-set membership (which also drops too-big / unreadable / transiently-absent files) and so cannot mass-delete the index when a scan momentarily returns few or no files.

Types

type FileEntry

type FileEntry struct {
	Path       string
	RelPath    string
	Size       int64
	ModifiedAt int64
}

func ScanDir

func ScanDir(root string) ([]FileEntry, error)

func ScanDirOpts

func ScanDirOpts(root string, opts ScanOptions) ([]FileEntry, error)

type ScanOptions

type ScanOptions struct {
	NoGitignore bool
}

Jump to

Keyboard shortcuts

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