Documentation
¶
Overview ¶
Package diff provides line-based diff computation using the LCS algorithm, unified format output, and JSON structure comparison. It supports configurable context lines around each change hunk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareJSON ¶
CompareJSON compares two parsed JSON values and returns a list of human-readable differences.
func CompareJSONBytes ¶
CompareJSONBytes parses and compares two JSON byte slices.
func FormatUnified ¶
FormatUnified formats hunks as a unified diff string.
func TruncateOrPad ¶
TruncateOrPad truncates a string to width or pads it with spaces.
Types ¶
type Hunk ¶
Hunk represents a contiguous block of changes.
func ComputeDiff ¶
ComputeDiff computes the diff between two slices of strings using an LCS algorithm. Returns hunks describing the changes.
type Option ¶
type Option func(*Options)
Option is a functional option for diff operations.
func WithContext ¶
WithContext sets the number of context lines around changes.