from

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chan added in v0.2.0

func Chan[T any](ctx context.Context, src <-chan T) iter.Seq[T]

Chan emits all values received on src and stops whenever src is closed or the context is cancelled.

func DirWalk added in v1.0.1

func DirWalk(ctx context.Context, fsys fs.FS, root string) iter.Seq2[DirStep, error]

DirWalk emits all entries for root and its subdirectories. Errors are forwarded, and the consumer may decide wether to stop iteration or continue consuming further values.

Use os.DirFS(path) to create fsys from disk.

func ScannerText

func ScannerText(s *bufio.Scanner) iter.Seq[string]

ScannerText emits all text emitted by s.

Cancellation must be handled by closing the source reader.

After ScannerText returns the caller is responsible for checking s.Err().

Types

type DirStep added in v1.0.1

type DirStep struct {
	// FullPath represents the path anchored to the root walk directory.
	// This mimics the behavior of "path" in fs.WalkDirFunc.
	Path string
	// Entry is the DirEntry that would be passed to fs.WalkDirFunc.
	Entry fs.DirEntry
}

DirStep represents a step in a directory Walk.

Jump to

Keyboard shortcuts

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