Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
language: go

go: 1.3
go:
- 1.4

before_install:
- mkdir -p $HOME/gopath/src/sourcegraph.com/sourcegraph
- mv $TRAVIS_BUILD_DIR $HOME/gopath/src/sourcegraph.com/sourcegraph/go-diff
- export TRAVIS_BUILD_DIR=$HOME/gopath/src/sourcegraph.com/sourcegraph/go-diff
- cd $TRAVIS_BUILD_DIR

install:
- go get golang.org/x/tools/cmd/vet

script:
- export TZ=US/Pacific # TODO: Fix this.
- go get -t -v ./...
- diff -u <(echo -n) <(gofmt -d ./)
- go tool vet ./
- go test -v -race ./...
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# go-diff [![status](https://sourcegraph.com/api/repos/github.com/sourcegraph/go-diff/.badges/status.png)](https://sourcegraph.com/github.com/sourcegraph/go-diff) [![views](https://sourcegraph.com/api/repos/github.com/sourcegraph/go-diff/.counters/views.png)](https://sourcegraph.com/github.com/sourcegraph/go-diff)
# go-diff [![Build Status](https://travis-ci.org/sourcegraph/go-diff.svg?branch=master)](https://travis-ci.org/sourcegraph/go-diff) [![status](https://sourcegraph.com/api/repos/sourcegraph.com/sourcegraph/go-diff/.badges/status.png)](https://sourcegraph.com/sourcegraph.com/sourcegraph/go-diff) [![views](https://sourcegraph.com/api/repos/sourcegraph.com/sourcegraph/go-diff/.counters/views.png)](https://sourcegraph.com/sourcegraph.com/sourcegraph/go-diff)

Diff parser and printer for Go.

**Unstable API:** go-diff is currently in development. If you depend on it, you should vendor it.

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](https://sourcegraph.com/github.com/sourcegraph/go-diff/.GoPackage/github.com/sourcegraph/go-diff/diff/.def/FileDiff)
struct.
Installing
----------

```bash
go get -u sourcegraph.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`](https://sourcegraph.com/sourcegraph.com/sourcegraph/go-diff/.GoPackage/sourcegraph.com/sourcegraph/go-diff/diff/.def/FileDiff) struct.

```diff
--- oldname 2009-10-11 15:12:20.000000000 -0700
Expand Down
2 changes: 1 addition & 1 deletion diff/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Package diff provides a parser for unified diffs.
package diff
package diff // import "sourcegraph.com/sourcegraph/go-diff/diff"