aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/object.go
diff options
context:
space:
mode:
authorJavi Fontan <jfontan@gmail.com>2018-03-26 23:18:54 +0200
committerJavi Fontan <jfontan@gmail.com>2018-03-27 17:32:59 +0200
commit05c414a169a75ca933402e5be19a5c4304aa4f00 (patch)
tree19dcd85c5d221cf41fa06c200423d5cc236f9f31 /storage/filesystem/object.go
parent160e6d5b654fbbaf0d9264f226c56a03f0e27d30 (diff)
downloadgo-git-05c414a169a75ca933402e5be19a5c4304aa4f00.tar.gz
*: Use CheckClose with named returns
Previously some close errors were losts. This is specially problematic in go-git as lots of work is done here like generating indexes and moving packfiles. Signed-off-by: Javi Fontan <jfontan@gmail.com>
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
}