Help us shape the future of Go! Take the 2026 Go Developer Survey

diff

package
v0.0.0-...-d757264 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compute

func Compute(nameA, nameB, yamlA, yamlB string) string

Compute returns a unified diff between two YAML strings. Returns empty string if they are equal.

Types

type DiffLine

type DiffLine struct {
	Left    string // empty if only added on right
	Right   string // empty if only removed on left
	LeftNo  int    // 0 means no line number
	RightNo int
	Kind    LineKind
}

DiffLine represents one row in a side-by-side diff.

func SideBySide

func SideBySide(unifiedDiff string) []DiffLine

SideBySide parses a unified diff string into paired left/right lines suitable for side-by-side rendering.

type LineKind

type LineKind int
const (
	LineEqual   LineKind = iota
	LineChanged          // left removed, right added (paired)
	LineRemoved          // only on left
	LineAdded            // only on right
	LineHunk             // @@ hunk header
)

Jump to

Keyboard shortcuts

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