diff --git a/cmd/ipfs/init.go b/cmd/ipfs/init.go index 9dc4f7fb8..e78b36584 100644 --- a/cmd/ipfs/init.go +++ b/cmd/ipfs/init.go @@ -85,7 +85,7 @@ environment variable: f := req.Files if f != nil { - it, _ := req.Files.Entries() + it := req.Files.Entries() if !it.Next() && it.Err() != nil { return it.Err() } diff --git a/core/commands/block.go b/core/commands/block.go index b50f4c141..670056098 100644 --- a/core/commands/block.go +++ b/core/commands/block.go @@ -153,7 +153,7 @@ than 'sha2-256' or format to anything other than 'v0' will result in CIDv1. return err } - it, _ := req.Files.Entries() + it := req.Files.Entries() if !it.Next() && it.Err() != nil { return it.Err() } diff --git a/core/commands/config.go b/core/commands/config.go index e2fc32b0c..787bba0d7 100644 --- a/core/commands/config.go +++ b/core/commands/config.go @@ -280,7 +280,7 @@ can't be undone. } defer r.Close() - it, _ := req.Files.Entries() + it := req.Files.Entries() if !it.Next() && it.Err() != nil { return it.Err() } diff --git a/core/commands/dag/dag.go b/core/commands/dag/dag.go index 0da4af91a..413f26bc7 100644 --- a/core/commands/dag/dag.go +++ b/core/commands/dag/dag.go @@ -92,7 +92,7 @@ into an object of the specified format. defer nd.Blockstore.PinLock().Unlock() } - it, _ := req.Files.Entries() + it := req.Files.Entries() for it.Next() { if it.File() == nil { return fmt.Errorf("expected a regular file") diff --git a/core/commands/files.go b/core/commands/files.go index 2792bad98..20fce2bfc 100644 --- a/core/commands/files.go +++ b/core/commands/files.go @@ -769,7 +769,7 @@ stat' on the file or any of its ancestors. return err } - it, _ := req.Files.Entries() + it := req.Files.Entries() if !it.Next() && it.Err() != nil { return it.Err() } diff --git a/core/commands/object/object.go b/core/commands/object/object.go index c21a193e2..b3ccc3b72 100644 --- a/core/commands/object/object.go +++ b/core/commands/object/object.go @@ -391,7 +391,7 @@ And then run: return err } - it, _ := req.Files.Entries() + it := req.Files.Entries() if !it.Next() && it.Err() != nil { return it.Err() } diff --git a/core/commands/object/patch.go b/core/commands/object/patch.go index 85f60f0fc..058fa661a 100644 --- a/core/commands/object/patch.go +++ b/core/commands/object/patch.go @@ -60,7 +60,7 @@ the limit will not be respected by the network. return err } - it, _ := req.Files.Entries() + it := req.Files.Entries() if !it.Next() && it.Err() != nil { return it.Err() } @@ -110,7 +110,7 @@ Example: return err } - it, _ := req.Files.Entries() + it := req.Files.Entries() if !it.Next() && it.Err() != nil { return it.Err() } diff --git a/core/commands/tar.go b/core/commands/tar.go index c03d1c0a9..92939a1eb 100644 --- a/core/commands/tar.go +++ b/core/commands/tar.go @@ -44,7 +44,7 @@ represent it. return err } - it, _ := req.Files.Entries() + it := req.Files.Entries() if !it.Next() && it.Err() != nil { return it.Err() } diff --git a/core/coreapi/unixfile.go b/core/coreapi/unixfile.go index f48caa9c5..1ec15ea37 100644 --- a/core/coreapi/unixfile.go +++ b/core/coreapi/unixfile.go @@ -79,7 +79,7 @@ func (d *ufsDirectory) Close() error { return nil } -func (d *ufsDirectory) Entries() (files.DirIterator, error) { +func (d *ufsDirectory) Entries() files.DirIterator { fileCh := make(chan *ipld.Link, prefetchFiles) go func() { d.dir.ForEachLink(d.ctx, func(link *ipld.Link) error { @@ -98,7 +98,7 @@ func (d *ufsDirectory) Entries() (files.DirIterator, error) { ctx: d.ctx, files: fileCh, dserv: d.dserv, - }, nil + } } func (d *ufsDirectory) Size() (int64, error) { diff --git a/core/coreapi/unixfs_test.go b/core/coreapi/unixfs_test.go index 55b7aa862..0ce78665c 100644 --- a/core/coreapi/unixfs_test.go +++ b/core/coreapi/unixfs_test.go @@ -567,8 +567,8 @@ func TestAdd(t *testing.T) { return } - origIt, _ := orig.(files.Directory).Entries() - gotIt, _ := got.(files.Directory).Entries() + origIt := orig.(files.Directory).Entries() + gotIt := got.(files.Directory).Entries() for { if origIt.Next() { diff --git a/core/coreunix/add.go b/core/coreunix/add.go index 66a0ed1d6..2e2641d4e 100644 --- a/core/coreunix/add.go +++ b/core/coreunix/add.go @@ -416,10 +416,7 @@ func (adder *Adder) AddAllAndPin(file files.Node) (ipld.Node, error) { // Iterate over each top-level file and add individually. Otherwise the // single files.File f is treated as a directory, affecting hidden file // semantics. - it, err := tf.Entries() - if err != nil { - return nil, err - } + it := tf.Entries() for it.Next() { if err := adder.addFile(it.Name(), it.Node()); err != nil { return nil, err @@ -537,7 +534,7 @@ func (adder *Adder) addDir(path string, dir files.Directory) error { return err } - it, _ := dir.Entries() + it := dir.Entries() for it.Next() { fpath := gopath.Join(path, it.Name())