diff

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyDiff

func AnyDiff[T any](have, want T) string

AnyDiff returns a textual representation of the differences between 'have' and 'want'. Consider using ReprDiff instead, which has a better human-readable output.

func ReprDiff added in v0.2.0

func ReprDiff[T any](have, want T) string

ReprDiff returns a highly human-readable unified diff of the string representation of (have, want). This is probably the function you are looking for.

func TextDiff

func TextDiff(oldLabel string, newLabel string, old string, new string) string

TextDiff returns a unified diff of the strings (old, new). Based on a copy of x/tools/internal/diff https://github.com/golang/tools/tree/master/internal/diff

func TextDiffPatient added in v0.1.3

func TextDiffPatient(oldName string, old []byte, newName string, new []byte) []byte

TextDiffPatient returns a unified diff of the strings (old,new), using the patient diff algorithm. Note that "patient" comes from "patient sorting": it is actually _faster_ than a standard diff algorithm. Based on a copy of x/tools/internal/diffp https://github.com/golang/go/tree/master/src/internal/diffp

Types

This section is empty.

Directories

Path Synopsis
internal
diff
Package diff computes differences between text files or strings.
Package diff computes differences between text files or strings.
diff/lcs
package lcs contains code to find longest-common-subsequences (and diffs)
package lcs contains code to find longest-common-subsequences (and diffs)
diff/myers
Package myers implements the Myers diff algorithm.
Package myers implements the Myers diff algorithm.
diffp
Package diffp implements a basic diff algorithm equivalent to patience diff.
Package diffp implements a basic diff algorithm equivalent to patience diff.

Jump to

Keyboard shortcuts

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