aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/object.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-04-02 10:39:47 +0200
committerGitHub <noreply@github.com>2018-04-02 10:39:47 +0200
commit0c2618bc7d495322c6413b0ff62549712747cf9e (patch)
tree03ddc67b73733d0582367e9038c454353fa55955 /storage/filesystem/object.go
parent160e6d5b654fbbaf0d9264f226c56a03f0e27d30 (diff)
parent6e07548d9078505ca2945f09d11729b14abcc907 (diff)
downloadgo-git-0c2618bc7d495322c6413b0ff62549712747cf9e.tar.gz
Merge pull request #794 from jfontan/fix/checkclose
Use CheckClose with named returns and fix tests
Diffstat (limited to 'storage/filesystem/object.go')
-rw-r--r--storage/filesystem/object.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/storage/filesystem/object.go b/storage/filesystem/object.go
index 9f1c5ef..26190fd 100644
--- a/storage/filesystem/object.go
+++ b/storage/filesystem/object.go
@@ -55,7 +55,7 @@ func (s *ObjectStorage) requireIndex() error {
return nil
}
-func (s *ObjectStorage) loadIdxFile(h plumbing.Hash) error {
+func (s *ObjectStorage) loadIdxFile(h plumbing.Hash) (err error) {
f, err := s.dir.ObjectPackIdx(h)
if err != nil {
return err
@@ -94,7 +94,7 @@ func (s *ObjectStorage) PackfileWriter() (io.WriteCloser, error) {
}
// SetEncodedObject adds a new object to the storage.
-func (s *ObjectStorage) SetEncodedObject(o plumbing.EncodedObject) (plumbing.Hash, error) {
+func (s *ObjectStorage) SetEncodedObject(o plumbing.EncodedObject) (h plumbing.Hash, err error) {
if o.Type() == plumbing.OFSDeltaObject || o.Type() == plumbing.REFDeltaObject {
return plumbing.ZeroHash, plumbing.ErrInvalidType
}
@@ -113,11 +113,11 @@ func (s *ObjectStorage) SetEncodedObject(o plumbing.EncodedObject) (plumbing.Has
defer ioutil.CheckClose(or, &err)
- if err := ow.WriteHeader(o.Type(), o.Size()); err != nil {
+ if err = ow.WriteHeader(o.Type(), o.Size()); err != nil {
return plumbing.ZeroHash, err
}
- if _, err := io.Copy(ow, or); err != nil {
+ if _, err = io.Copy(ow, or); err != nil {
return plumbing.ZeroHash, err
}