package diff
import "github.com/pkg/diff"
Package diff contains high level routines that generate a textual diff.
It is implemented in terms of the other packages in this module. If you want fine-grained control, want to inspect a diff programmatically, want to provide a context for cancellation, need to diff gigantic files that don't fit in memory, or want to diff unusual things, use the lower level packages.
Index ¶
- func Slices(aName, bName string, a, b interface{}, w io.Writer, options ...write.Option) error
- func Text(aFile, bFile string, a, b interface{}, w io.Writer, options ...write.Option) error
Functions ¶
func Slices ¶
Slices diffs slices a and b and writes the result to w. It uses fmt.Print to print the elements of a and b. It uses reflect.DeepEqual to compare elements of a and b. It uses aName and bName as the names of a and b in the output.
func Text ¶
Text diffs a and b and writes the result to w. It treats a and b as text, and splits their contents into lines using bufio.ScanLines. aFile and bFile are filenames to use in the output.
a and b each may be nil or may have type string, []byte, or io.Reader. If nil, the text is read from the filename.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd | |
cmd/pkg-diff-example | Command pkg-diff-example implements a subset of the diff command using github.com/pkg/diff. |
ctxt | Package ctxt provides routines to reduce the amount of context in an edit script. |
edit | Package edit provides edit scripts. |
intern | Package intern provides string interning. |
myers | Package myers implements the Myers diff algorithm. |
write | Package write provides routines for writing diffs. |
- Version
- v0.0.0-20241224192749-4e6772a4315c (latest)
- Published
- Dec 24, 2024
- Platform
- js/wasm
- Imports
- 12 packages
- Last checked
- now –
Tools for package owners.