commit | 55c4b2b398cf71d560f802bfd62a15df42da843e | [log] [tgz] |
---|---|---|
author | Aryan Naraghi <aryan.naraghi@gmail.com> | Mon Dec 12 21:23:29 2016 |
committer | GitHub <noreply@github.com> | Mon Dec 12 21:23:29 2016 |
tree | 916c0c04cc5e7dd779dbc14e2ee20dbb8353236b | |
parent | 035af7c09b120b0909dd998c92745b82f61e0b1c [diff] | |
parent | f2026ab398e14f6703cab26c1ad8b8ba393b2f44 [diff] |
Merge pull request #2 from tmildorf/master Add a permissive license.
difflib is a simple library written in Go for diffing two sequences of text.
To install, issue:
go get github.com/aryann/difflib
To start using difflib, create a new file in your workspace and import difflib:
import ( ... "fmt" "github.com/aryann/difflib" ... )
Then call either difflib.Diff
or difflib.HTMLDiff
:
fmt.Println(difflib.HTMLDiff([]string{"one", "two", "three"}, []string{"two", "four", "three"}))
If you'd like more control over the output, see how the function HTMLDiff
relies on Diff
in difflib.go.
There is a demo application in the difflib_demo directory. To run it, navigate to your $GOPATH
and run:
go run src/github.com/aryann/difflib/difflib_server/difflib_demo.go <file-1> <file-2>
Where <file-1>
and <file-2>
are two text files you'd like to diff. The demo will launch a web server that will contain a table of the diff results.