A diff tool for Go languange. It shows the semantic differences between two Go source files.
- Order of importstatements
- Order of definitions of global type/const/var/func
- Whether more than one parameters or global variables are declared in one line. e.g. var a, b int = 1, 2is equivalent tovar a int = 1; var b int = 2. (NOTE parallel assignments are not normalized)
- All comments.
- Code formats. e.g. some useless new lines.
- Smart matching algorithm on go ast tree.
- If a function is deleted or added as a whole, only one-line message is shown (starting by ===or###)
- Easily see which function or type, etc. the difference is in.
- Import/const/var/func diffrences are shown in order, independent of the lines' order in the source.
- Token based line-line difference presentation.
$ go get -u github.com/daviddengcn/go-diff
$ go install github.com/daviddengcn/go-diff
$ go-diff <old-file> <new-file>(Make sure $GO_PATH/bin is in system's $PATH)
Used as git diff
- 
Link scripts/go-diff.gs(you need install gosl) orscripts/go-diff.shto a folder inPATH
- 
Set Git external diff driver (change go-diff.gstogo-diff.shaccordingly if necessary)
$ git config [--global] diff.external go-diff.gs
$ git diffBSD license