Skip to content
forked from aryann/difflib

Used by get-kapp.io

License

Notifications You must be signed in to change notification settings

carvel-dev/difflib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc

difflib

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

Installing

To install, issue:

go get github.com/aryann/difflib

Using

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.

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/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.

About

Used by get-kapp.io

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%