Documentation
¶
Overview ¶
Package diff renders a `git diff --no-prefix`-style unified-diff string from two text inputs. The implementation is a line-level Myers algorithm with a hard output cap so a pathological input cannot blow the confirmation prompt to megabytes.
The package has no external dependencies and is safe to call with arbitrary byte sequences (CR, NUL, mixed-encoding bytes are passed through verbatim — line splitting is on `\n` only, the same as `git diff` for a binary-ish file).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unified ¶
Unified returns a unified-diff block describing the change from oldContent to newContent for a file conventionally named name.
Identical inputs → empty string. Empty oldContent → header + every line of newContent prefixed with "+". Empty newContent → header + every line of oldContent prefixed with "-".
Output is capped at the package-level maxLines / maxBytes; when the cap fires, a single "[... N lines truncated ...]" marker is emitted at the truncation point and the rest of the diff is dropped.
Types ¶
This section is empty.