aboutsummaryrefslogtreecommitdiffstats
path: root/file.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-22 03:29:05 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-22 03:29:05 +0200
commit2ed3474ab8e52c98a87e390d5128d45d693a115d (patch)
tree6f136c2508c22f6b5146ef08c49821a45a5f2357 /file.go
parent5b13c1a2e55cb442484d9c7b45389f422b110eec (diff)
downloadgo-git-2ed3474ab8e52c98a87e390d5128d45d693a115d.tar.gz
ForEach review and Commit.Tree err return
Diffstat (limited to 'file.go')
-rw-r--r--file.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/file.go b/file.go
index 58c76d2..ef17c6e 100644
--- a/file.go
+++ b/file.go
@@ -75,13 +75,12 @@ func (iter *FileIter) Next() (*File, error) {
// ForEach call the cb function for each file contained on this iter until
// an error happends or the end of the iter is reached. If core.ErrStop is sent
-// the iteration is stop but no error is returned
+// the iteration is stop but no error is returned. The iterator is closed.
func (iter *FileIter) ForEach(cb func(*File) error) error {
- i := &FileIter{w: *NewTreeWalker(iter.w.r, iter.w.t)}
- defer i.Close()
+ defer iter.Close()
for {
- f, err := i.Next()
+ f, err := iter.Next()
if err != nil {
if err == io.EOF {
return nil