aboutsummaryrefslogtreecommitdiffstats
path: root/storage/test/storage_suite.go
diff options
context:
space:
mode:
authorKyungmin Bae <kyungmin.bae@devsisters.com>2020-05-24 02:29:58 +0900
committerKyungmin Bae <kyungmin.bae@devsisters.com>2020-05-24 02:29:58 +0900
commit10199949b9e5a71f72241c4bb23f3d733287065c (patch)
tree52b3efdb1944d9c833522d32a0af5c4b275a3ab6 /storage/test/storage_suite.go
parent6d8103df45ce09ffd5323b4ef46d26440400a54f (diff)
downloadgo-git-10199949b9e5a71f72241c4bb23f3d733287065c.tar.gz
Close Reader & Writer of EncodedObject after use
Diffstat (limited to 'storage/test/storage_suite.go')
-rw-r--r--storage/test/storage_suite.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/storage/test/storage_suite.go b/storage/test/storage_suite.go
index d87a7dd..2c00e75 100644
--- a/storage/test/storage_suite.go
+++ b/storage/test/storage_suite.go
@@ -494,12 +494,12 @@ func objectEquals(a plumbing.EncodedObject, b plumbing.EncodedObject) error {
ra, err := a.Reader()
if err != nil {
- return fmt.Errorf("can't get reader on b: %q", err)
+ return fmt.Errorf("can't get reader on a: %q", err)
}
rb, err := b.Reader()
if err != nil {
- return fmt.Errorf("can't get reader on a: %q", err)
+ return fmt.Errorf("can't get reader on b: %q", err)
}
ca, err := ioutil.ReadAll(ra)
@@ -516,5 +516,15 @@ func objectEquals(a plumbing.EncodedObject, b plumbing.EncodedObject) error {
return errors.New("content does not match")
}
+ err = rb.Close()
+ if err != nil {
+ return fmt.Errorf("can't close reader on b: %q", err)
+ }
+
+ err = ra.Close()
+ if err != nil {
+ return fmt.Errorf("can't close reader on a: %q", err)
+ }
+
return nil
}