fix golint issues in core/stores (#527)

This commit is contained in:
Kevin Wan
2021-02-28 23:02:49 +08:00
committed by GitHub
parent 490241d639
commit c566b5ff82
35 changed files with 348 additions and 82 deletions

View File

@@ -8,6 +8,7 @@ import (
)
type (
// Iter interface represents a mongo iter.
Iter interface {
All(result interface{}) error
Close() error
@@ -19,6 +20,7 @@ type (
Timeout() bool
}
// A ClosableIter is a closable mongo iter.
ClosableIter struct {
Iter
Cleanup func()
@@ -57,6 +59,7 @@ func (i promisedIter) For(result interface{}, f func() error) error {
return i.promise.keep(err)
}
// Close closes a mongo iter.
func (it *ClosableIter) Close() error {
err := it.Iter.Close()
it.Cleanup()