GithubHelp home page GithubHelp logo

go-diff's Introduction

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

go-diff's People

Contributors

daviddengcn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.