Categorygithub.com/shazow/go-diff
modulepackage
0.0.0-20160112020656-b6b7b6733b8c
Repository: https://github.com/shazow/go-diff.git
Documentation: pkg.go.dev

# README

GoDoc License Build Status

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:

Sponsors

Work on this package is sponsored by Sourcegraph.

License

MIT.

# Packages

This package implements the diff.Differ interface using github.com/mb0/diff as a backend.
This package implements the diff.Differ interface using diffmatchpatch as a backend.
This package implements the diff.Differ interface using github.com/mb0/diff as a backend.

# 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.

# Structs

Object is the minimum representation for generating diffs with git-style headers.
Writer writes diffs using a given Differ including git-style headers between each patch.

# Interfaces

Differ supplies a stream-based diffing algorithm implementation.