modulepackage
0.0.0-20160112020656-b6b7b6733b8c
Repository: https://github.com/shazow/go-diff.git
Documentation: pkg.go.dev
# README
go-diff
Library for generating Git-style diff patchsets in Go.
Built to be used in the pure-Go implementation of the Git backend for sourcegraph's go-vcs.
Status: Prototyping. None of the backends produce complete output yet, but the difflib one is closest and least broken.
Features
- Git-style patch headers for each file (are there other styles to support?).
- Bring your own diff algorithm by implementing the Differ interface.
- Includes a few diffing backends:
- pmezard/go-difflib (default)
- sergi/go-diff/diffmatchpatch (offsets produced are inconsistent with git diff)
- mb0/diff (incomplete backend)
Sponsors
Work on this package is sponsored by Sourcegraph.
License
MIT.
# Functions
DefaultDiffer returns a diffmatchpatch-based differ.
# Variables
EmptyObject can be used when there is no corresponding src or dst entry, such as during deletions or creations.
ErrEmptyComparison is used when both src and dst are EmptyObjects.
# Interfaces
Differ supplies a stream-based diffing algorithm implementation.