Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sourcegraph/go-diff
Unified diff parser and printer for Go
https://github.com/sourcegraph/go-diff
Last synced: 3 months ago
JSON representation
Unified diff parser and printer for Go
- Host: GitHub
- URL: https://github.com/sourcegraph/go-diff
- Owner: sourcegraph
- License: other
- Created: 2014-08-31T01:51:51.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-02-23T16:31:39.000Z (11 months ago)
- Last Synced: 2024-10-24T19:48:00.450Z (3 months ago)
- Language: Go
- Homepage: https://sourcegraph.com/github.com/sourcegraph/go-diff
- Size: 174 KB
- Stars: 427
- Watchers: 85
- Forks: 48
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome - sourcegraph/go-diff - 02 star:0.4k fork:0.0k Unified diff parser and printer for Go (Go)
- awesome-repositories - sourcegraph/go-diff - Unified diff parser and printer for Go (Go)
- go-awesome - sourcegraph/go-diff - Go version of the diff toolkit (Open source library / Word Processing)
README
# go-diff [![Build Status](https://travis-ci.org/sourcegraph/go-diff.svg?branch=master)](https://travis-ci.org/sourcegraph/go-diff) [![GoDoc](https://godoc.org/github.com/sourcegraph/go-diff/diff?status.svg)](https://godoc.org/github.com/sourcegraph/go-diff/diff)
Diff parser and printer for Go.
Installing
----------```bash
go get -u github.com/sourcegraph/go-diff/diff
```Usage
-----It doesn't actually compute a diff. It only reads in (and prints out, given a Go struct representation) unified diff output, such as the following. The corresponding data structure in Go is the `diff.FileDiff` struct.
```diff
--- oldname 2009-10-11 15:12:20.000000000 -0700
+++ newname 2009-10-11 15:12:30.000000000 -0700
@@ -1,3 +1,9 @@ Section Header
+This is an important
+notice! It should
+therefore be located at
+the beginning of this
+document!
+
This part of the
document has stayed the
same from version to
@@ -5,16 +11,10 @@
be shown if it doesn't
change. Otherwise, that
would not be helping to
-compress the size of the
-changes.
-
-This paragraph contains
-text that is outdated.
-It will be deleted in the
-near future.
+compress anything.
```