Documentation
¶
Overview ¶
Package dirsource implements the filesystem source (ARCHITECTURE.md §7): streaming enumeration with a nested per-directory .gitignore/.airomignore stack, non-overridable default skips, user --ignore globs, and an ignore-honoring resolver for the phase-2 pull API. Symlinks are never followed (which also forecloses cycles); non-regular files are skipped; permission failures below the root degrade to Unknown records (invariant P6) while an unreadable root is a fatal source-acquisition failure.
Concurrency: Walk keeps all traversal state walk-local, so concurrent Walks — including the Resolver's pulls, which run in parallel during phase 2 (§8) — are safe.
Package dirsource implements the local-directory Source (ARCHITECTURE.md §7): fastwalk enumeration with a per-directory nested .gitignore stack (gocodewalker semantics), .airomignore, and default skips (.git, node_modules, vendor, virtualenvs); an 8 KB NUL-sniff for binary detection; symlink cycles guarded by (dev, inode); and permission errors degraded to Unknowns, never fatal (invariant P6).
Directory trees are the seekable easy case of the Source contract, so ReaderAt is fully supported here. dirsource is also the delegation target for gitsource, which scans its shallow clone as a plain filesystem.
Index ¶
- type Options
- type Source
- func (s *Source) Close() error
- func (s *Source) ID() string
- func (s *Source) Info() source.Info
- func (s *Source) Kind() source.Kind
- func (s *Source) Name() string
- func (s *Source) Resolver() source.Resolver
- func (s *Source) Walk(ctx context.Context, fn source.WalkFunc) error
- func (s *Source) WalkStats() source.WalkStats
- func (s *Source) WalkUnknowns() []source.Unknown
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// IgnoreGlobs are user --ignore doublestar patterns over root-relative
// slash paths, applied on top of the ignore-file stack.
IgnoreGlobs []string
}
Options configures a directory source.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source is the dir implementation of source.Source.
func (*Source) Resolver ¶
Resolver returns the pull-style query API. Every method honors the same ignore rules as Walk — a phase-2 detector can never see a file phase 1 could not — and confines access to the scan root even through symlinks. Safe for concurrent use (walk state is per-invocation).
func (*Source) Walk ¶
Walk streams regular, non-ignored files, then publishes the walk's Unknown records. Entries are emitted from multiple goroutines (fastwalk's internal parallelism); Walk returns only after every callback has returned, so a caller may close a channel after Walk without racing sends.
func (*Source) WalkStats ¶ added in v0.4.2
WalkStats returns the exclusion accounting of the most recent top-level Walk. Like WalkUnknowns, Resolver pulls never clobber it.
func (*Source) WalkUnknowns ¶
WalkUnknowns returns walk-level failures published by the most recent top-level Walk. Resolver pulls never clobber these.