diff --git a/basic_ds.go b/basic_ds.go index 2cb7568..5c5a0ad 100644 --- a/basic_ds.go +++ b/basic_ds.go @@ -1,7 +1,6 @@ package datastore import ( - "io" "log" dsq "github.com/ipfs/go-datastore/query" @@ -244,10 +243,7 @@ func (d *LogBatch) Commit() (err error) { func (d *LogDatastore) Close() error { log.Printf("%s: Close\n", d.Name) - if cds, ok := d.child.(io.Closer); ok { - return cds.Close() - } - return nil + return d.child.Close() } func (d *LogDatastore) Check() error { diff --git a/keytransform/keytransform.go b/keytransform/keytransform.go index be7db57..e2891a4 100644 --- a/keytransform/keytransform.go +++ b/keytransform/keytransform.go @@ -1,8 +1,6 @@ package keytransform import ( - "io" - ds "github.com/ipfs/go-datastore" dsq "github.com/ipfs/go-datastore/query" ) @@ -84,10 +82,7 @@ func (d *ktds) Query(q dsq.Query) (dsq.Results, error) { } func (d *ktds) Close() error { - if c, ok := d.child.(io.Closer); ok { - return c.Close() - } - return nil + return d.child.Close() } // DiskUsage implements the PersistentDatastore interface. diff --git a/mount/mount.go b/mount/mount.go index 8f2a89e..9e2622f 100644 --- a/mount/mount.go +++ b/mount/mount.go @@ -5,7 +5,6 @@ package mount import ( "errors" "fmt" - "io" "sort" "strings" "sync" @@ -195,11 +194,9 @@ func (d *Datastore) IsThreadSafe() {} func (d *Datastore) Close() error { for _, d := range d.mounts { - if c, ok := d.Datastore.(io.Closer); ok { - err := c.Close() - if err != nil { - return err - } + err := d.Datastore.Close() + if err != nil { + return err } } return nil diff --git a/sync/sync.go b/sync/sync.go index 2218483..d222016 100644 --- a/sync/sync.go +++ b/sync/sync.go @@ -1,7 +1,6 @@ package sync import ( - "io" "sync" ds "github.com/ipfs/go-datastore" @@ -93,10 +92,7 @@ func (d *MutexDatastore) Batch() (ds.Batch, error) { func (d *MutexDatastore) Close() error { d.RWMutex.Lock() defer d.RWMutex.Unlock() - if c, ok := d.child.(io.Closer); ok { - return c.Close() - } - return nil + return d.child.Close() } // DiskUsage implements the PersistentDatastore interface.