diff options
| author | Russ Cox <rsc@golang.org> | 2011-11-01 22:05:34 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-11-01 22:05:34 -0400 |
| commit | eb6929299b6da3d9bea1fa7f7cd319c2de9242bb (patch) | |
| tree | d3309a8985202985334709bc50e1a737ea117593 /src/pkg/patch/git.go | |
| parent | c2049d2dfeeea3d41fafa91e3e3f0e47c285355b (diff) | |
| download | go-eb6929299b6da3d9bea1fa7f7cd319c2de9242bb.tar.xz | |
src/pkg/[n-z]*: gofix -r error -force=error
R=golang-dev, bsiegert, iant
CC=golang-dev
https://golang.org/cl/5294074
Diffstat (limited to 'src/pkg/patch/git.go')
| -rw-r--r-- | src/pkg/patch/git.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pkg/patch/git.go b/src/pkg/patch/git.go index 6516097260..454eadecec 100644 --- a/src/pkg/patch/git.go +++ b/src/pkg/patch/git.go @@ -9,9 +9,9 @@ import ( "compress/zlib" "crypto/sha1" "encoding/git85" + "errors" "fmt" "io" - "os" ) func gitSHA1(data []byte) []byte { @@ -34,7 +34,7 @@ type GitBinaryLiteral struct { } // Apply implements the Diff interface's Apply method. -func (d *GitBinaryLiteral) Apply(old []byte) ([]byte, os.Error) { +func (d *GitBinaryLiteral) Apply(old []byte) ([]byte, error) { if sum := gitSHA1(old); !bytes.HasPrefix(sum, d.OldSHA1) { return nil, ErrPatchFailure } @@ -68,7 +68,7 @@ func getHex(s []byte) (data []byte, rest []byte) { } // ParseGitBinary parses raw as a Git binary patch. -func ParseGitBinary(raw []byte) (Diff, os.Error) { +func ParseGitBinary(raw []byte) (Diff, error) { var oldSHA1, newSHA1 []byte var sawBinary bool @@ -97,24 +97,24 @@ func ParseGitBinary(raw []byte) (Diff, os.Error) { } defer z.Close() if _, err = io.ReadFull(z, data); err != nil { - if err == os.EOF { + if err == io.EOF { err = io.ErrUnexpectedEOF } return nil, err } var buf [1]byte m, err := z.Read(buf[0:]) - if m != 0 || err != os.EOF { - return nil, os.NewError("Git binary literal longer than expected") + if m != 0 || err != io.EOF { + return nil, errors.New("Git binary literal longer than expected") } if sum := gitSHA1(data); !bytes.HasPrefix(sum, newSHA1) { - return nil, os.NewError("Git binary literal SHA1 mismatch") + return nil, errors.New("Git binary literal SHA1 mismatch") } return &GitBinaryLiteral{oldSHA1, data}, nil } if !sawBinary { - return nil, os.NewError("unexpected Git patch header: " + string(first)) + return nil, errors.New("unexpected Git patch header: " + string(first)) } } panic("unreachable") |
