A diff tool for Go languange. It shows the semantic differences between two Go source files.
- Order of
- Order of definitions of global
- Whether more than one parameters or global variables are declared in one line. e.g.
var a, b int = 1, 2is equivalent to
var 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
- 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>
$GO_PATH/bin is in system's
Used as git diff
scripts/go-diff.gs(you need install gosl) or
scripts/go-diff.shto a folder in
Set Git external diff driver (change
go-diff.shaccordingly if necessary)
$ git config [--global] diff.external go-diff.gs $ git diff