Skip to content

Conversation

vangent
Copy link
Contributor

@vangent vangent commented Jul 26, 2025

Fixes #3488.

@vangent vangent merged commit 6ee9d4c into google:master Jul 26, 2025
4 checks passed
@vangent vangent deleted the iter branch July 26, 2025 18:03
@@ -611,6 +612,28 @@ func (i *ListIterator) Next(ctx context.Context) (*ListObject, error) {
return i.Next(ctx)
}

// All iterates over the iterator, returning a *ListObject and a download function for each entry.
func (i *ListIterator) All(ctx context.Context, err *error) iter.Seq2[*ListObject, func(io.Writer, *ReaderOptions) error] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to say more about the err arg.
But there is a better way: instead of the arg, return a func() error.

  • The compiler won't let you ignore it, as it would with the arg.
  • You can catch early calls (before the iterator is done).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

blob: Bucket.List() with Go 1.23 iterators
2 participants