Use utils.LogClose for deferred closing in miniogw (#239)

This commit is contained in:
Kaloyan Raev 2018-08-17 20:17:58 +03:00 committed by Cameron
parent 906643fce2
commit ae430b8c10

View File

@ -18,6 +18,7 @@ import (
"storj.io/storj/pkg/storage/buckets"
"storj.io/storj/pkg/storage/meta"
"storj.io/storj/pkg/storage/objects"
"storj.io/storj/pkg/utils"
"storj.io/storj/storage"
)
@ -111,22 +112,12 @@ func (s *storjObjects) GetObject(ctx context.Context, bucket, object string,
if err != nil {
return err
}
defer func() {
if err := rr.Close(); err != nil {
// ignore for now
}
}()
defer utils.LogClose(rr)
r, err := rr.Range(ctx, startOffset, length)
if err != nil {
return err
}
defer func() {
if err = r.Close(); err != nil {
// ignore for now
}
}()
defer utils.LogClose(r)
_, err = io.Copy(writer, r)
return err
}