Unified diff parser and printer for Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/go-diff add go-diff diagnostic program Dec 16, 2014
diff Add support for parsing header timestamps without fractional seconds. ( Oct 31, 2017
.travis.yml add 1.10.x travis build for verification Oct 9, 2018
LICENSE license and readme Sep 1, 2014
README.md remove old link and remove "unstable" now that it's used in prod Apr 12, 2017
go.mod add go.mod files, set GO111MODULE=on in Travis build Oct 9, 2018
go.sum

README.md

go-diff Build Status GoDoc

Diff parser and printer for Go.

Installing

go get -u sourcegraph.com/sourcegraph/go-diff/diff

Usage

It doesn't actually compute a diff. It only reads in (and prints out, given a Go struct representation) unified diff output, such as the following. The corresponding data structure in Go is the diff.FileDiff struct.

--- oldname	2009-10-11 15:12:20.000000000 -0700
+++ newname	2009-10-11 15:12:30.000000000 -0700
@@ -1,3 +1,9 @@ Section Header
+This is an important
+notice! It should
+therefore be located at
+the beginning of this
+document!
+
 This part of the
 document has stayed the
 same from version to
@@ -5,16 +11,10 @@
 be shown if it doesn't
 change.  Otherwise, that
 would not be helping to
-compress the size of the
-changes.
-
-This paragraph contains
-text that is outdated.
-It will be deleted in the
-near future.
+compress anything.