Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
aryann Merge pull request #5 from patrickod/patrickod/fix-html-diff-tests
Add class="line-num" to the deleted test fixture lines
Latest commit e206f87 Jul 10, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
difflib_server Removed some extraneous CSS. Nov 23, 2012
LICENSE Add a permissive license. Dec 12, 2016 godoc badge. Feb 23, 2017
difflib.go Add lost `line-num` style to deleted lines Feb 24, 2017
difflib_test.go Add class="line-num" to the deleted test fixture lines Jul 8, 2017



difflib is a simple library written in Go for diffing two sequences of text.


To install, issue:

go get


To start using difflib, create a new file in your workspace and import difflib:

import (

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.

Running the Demo

There is a demo application in the difflib_demo directory. To run it, navigate to your $GOPATH and run:

go run src/ <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.

You can’t perform that action at this time.