From 2d6df58bb590f46dbfb4c948e8f6e0950763b7e9 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Thu, 14 May 2015 17:14:10 -0700 Subject: [PATCH 1/3] Clarify canonical import path, fix broken links. The canonical import path for this package appears to be "sourcegraph.com/sourcegraph/go-diff/diff", not "github.com/sourcegraph/go-diff/diff". Add an import path comment to enforce and document this. Also mention the import path in README, so there's no need to guess what it actually is. Fix broken views counter image. Fix broken definition link. Add Travis build status badge. Update Travis Go to current version. --- .travis.yml | 2 +- README.md | 18 ++++++++++++------ diff/doc.go | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index a680cf6..f02913c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ language: go -go: 1.3 +go: 1.4 diff --git a/README.md b/README.md index aca25b4..82d6a73 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/diff/doc.go b/diff/doc.go index 12fe96a..01f06dd 100644 --- a/diff/doc.go +++ b/diff/doc.go @@ -1,2 +1,2 @@ // Package diff provides a parser for unified diffs. -package diff +package diff // import "sourcegraph.com/sourcegraph/go-diff/diff" From 714933c994bca19403b286146ef165662503d444 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Thu, 14 May 2015 18:18:33 -0700 Subject: [PATCH 2/3] Fix travis script. Due to the vanity import path, we need to move the package into the correct location inside GOPATH workspace. --- .travis.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f02913c..5016588 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,19 @@ language: go -go: 1.4 +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: + - go get -t -v ./... + - diff -u <(echo -n) <(gofmt -d ./) + - go tool vet ./ + - go test -v -race ./... From f23a1b83147b327686f8ad0fac2341f25bf104c5 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Thu, 14 May 2015 18:31:02 -0700 Subject: [PATCH 3/3] Travis: Force timezone to Pacific to make tests pass, for now. This is a quick hack. The correct solution will be to fix tests so they pass regardless of user's timezone. See issue #6. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5016588..968e765 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ 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 ./