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.


License
BSD-3-Clause
Install
go get github.com/pkg/diff

Documentation

diff GoDoc

Module github.com/pkg/diff can be used to create, modify, and print diffs.

The top level package, diff, contains convenience functions for the most common uses.

The subpackages provide very fine-grained control over every aspect:

  • myers creates diffs using the Myers diff algorithm.
  • edit contains the core diff data types.
  • ctxt provides tools to reduce the amount of context in a diff.
  • write provides routines to write diffs in standard formats.

License: BSD 3-Clause.

Contributing

Contributions are welcome. However, I am not always fast to respond. I apologize for any sadness or frustration that that causes.

Useful background reading about diffs:

This module has not yet reached v1.0; the API is not yet settled (issue #18).