Documentation
¶
Overview ¶
Package textread provides bounded UTF-8 line scanning for filesystem adapters with different consumer result policies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func LineNumber ¶
LineNumber returns the one-based line attached to a scan failure, or zero when the failure is not line-specific.
func VisitLines ¶
func VisitLines(ctx context.Context, source io.Reader, limits Limits, visit func(number int, line []byte) error) error
VisitLines validates and normalizes a complete bounded input, then calls visit for each one-based line. The line slice is valid only until visit returns. A trailing newline contributes a final empty line, matching Scan's editor-facing line identity.
Types ¶
type Limits ¶
Limits define one complete UTF-8 line scan without prescribing what a consumer retains. InputBytes includes line separators and a UTF-8 BOM; LineBytes applies after BOM/CRLF normalization.
type Options ¶
type Options struct {
InputBytes int64
LineBytes int
OutputBytes int
StartLine int
MaxLines int
PartialLine bool
}
Options defines one complete scan. StartLine is zero-based, MaxLines zero means the rest of the file, and PartialLine permits the last selected line to be clipped at a UTF-8 boundary when the output budget is exhausted.