diff

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Differ

type Differ interface {
	// Diff compares two objects and returns an ASCII Diff string.
	Diff(before, after any) (asciiDiff string, err error)
}

Differ defines the contract for comparing two objects and generating a diff.

func NewJSONASCIIDiffer

func NewJSONASCIIDiffer() Differ

NewJSONASCIIDiffer creates a new JSON differ that outputs ANSI-colored ASCII diffs.

func NewJSONDiffer

func NewJSONDiffer() Differ

NewJSONDiffer creates a new JSON differ that strips ANSI colors. It accepts nil, map[string]any, []any, or any strong-typed value which will be normalized via JSON round-trip.

type UnifiedDiffFormatDiffer

type UnifiedDiffFormatDiffer struct{}

UnifiedDiffFormatDiffer generates a diff in a format similar to `git diff`.

func NewUnifiedDiffFormatDiffer

func NewUnifiedDiffFormatDiffer() *UnifiedDiffFormatDiffer

NewUnifiedDiffFormatDiffer creates a new GitDiffer.

func (*UnifiedDiffFormatDiffer) Diff

func (d *UnifiedDiffFormatDiffer) Diff(before, after io.Reader, filePath string) (string, error)

Diff compares two texts and returns a git-style diff string.

Jump to

Keyboard shortcuts

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