diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-04-02 10:39:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-02 10:39:47 +0200 |
commit | 0c2618bc7d495322c6413b0ff62549712747cf9e (patch) | |
tree | 03ddc67b73733d0582367e9038c454353fa55955 /plumbing/format/packfile | |
parent | 160e6d5b654fbbaf0d9264f226c56a03f0e27d30 (diff) | |
parent | 6e07548d9078505ca2945f09d11729b14abcc907 (diff) | |
download | go-git-0c2618bc7d495322c6413b0ff62549712747cf9e.tar.gz |
Merge pull request #794 from jfontan/fix/checkclose
Use CheckClose with named returns and fix tests
Diffstat (limited to 'plumbing/format/packfile')
-rw-r--r-- | plumbing/format/packfile/common.go | 3 | ||||
-rw-r--r-- | plumbing/format/packfile/scanner.go | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/plumbing/format/packfile/common.go b/plumbing/format/packfile/common.go index 7dad1f6..beb015d 100644 --- a/plumbing/format/packfile/common.go +++ b/plumbing/format/packfile/common.go @@ -40,8 +40,7 @@ func UpdateObjectStorage(s storer.EncodedObjectStorer, packfile io.Reader) error return err } -func writePackfileToObjectStorage(sw storer.PackfileWriter, packfile io.Reader) error { - var err error +func writePackfileToObjectStorage(sw storer.PackfileWriter, packfile io.Reader) (err error) { w, err := sw.PackfileWriter() if err != nil { return err diff --git a/plumbing/format/packfile/scanner.go b/plumbing/format/packfile/scanner.go index 8c216f1..6fc183b 100644 --- a/plumbing/format/packfile/scanner.go +++ b/plumbing/format/packfile/scanner.go @@ -279,14 +279,15 @@ func (s *Scanner) NextObject(w io.Writer) (written int64, crc32 uint32, err erro // from it zlib stream in an object entry in the packfile. func (s *Scanner) copyObject(w io.Writer) (n int64, err error) { if s.zr == nil { - zr, err := zlib.NewReader(s.r) + var zr io.ReadCloser + zr, err = zlib.NewReader(s.r) if err != nil { return 0, fmt.Errorf("zlib initialization error: %s", err) } s.zr = zr.(readerResetter) } else { - if err := s.zr.Reset(s.r, nil); err != nil { + if err = s.zr.Reset(s.r, nil); err != nil { return 0, fmt.Errorf("zlib reset error: %s", err) } } |