go-diff

command module
v0.0.0-...-85d0a4f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2014 License: BSD-2-Clause-Views Imports: 15 Imported by: 0

README

go-diff

A diff tool for Go languange. It shows the semantic differences between two Go source files.

Ignored Difference

  1. Order of import statements
  2. Order of definitions of global type/const/var/func
  3. Whether more than one parameters or global variables are declared in one line. e.g. var a, b int = 1, 2 is equivalent to var a int = 1; var b int = 2. (NOTE parallel assignments are not normalized)
  4. All comments.
  5. Code formats. e.g. some useless new lines.

Other Features

  1. Smart matching algorithm on go ast tree.
  2. If a function is deleted or added as a whole, only one-line message is shown (starting by === or ###)
  3. Easily see which function or type, etc. the difference is in.
  4. Import/const/var/func diffrences are shown in order, independent of the lines' order in the source.
  5. Token based line-line difference presentation.

Installation

$ go get -u github.com/daviddengcn/go-diff
$ go install github.com/daviddengcn/go-diff
$ go-diff <new-file> <org-file>

(Make sure $GO_PATH/bin is in system's $PATH)

Used as git diff

$ git config [--global] diff.external go-diff
$ git diff

License

BSD license

Documentation

Overview

go-diff is a tool checking semantic difference between source files.

Currently supported language:

Go fully

If the language is not supported or parsing is failed for either file, a line-to-line comparing is imposed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL