A fork of Go tools. Go-diff-patch is an utility library that is used to generate git-compatible patches that are appliable to any repository.
go-diff-patch
can be installed using the go get
command as shown below:
go get github.com/sourcegraph/go-diff-patch
The library exports a function GeneratePatch
which computes edits between the original and updated file contents and produces a unified diff for them as a string. This patch can then be applied to a valid git repository containing the specified file(s).
An example can be found in the examples/
directory.