Skip to content

fix: IterChan.Next returns true on error events without storing a new value - #8

Open
childish-sambino wants to merge 1 commit into
Files-com:masterfrom
childish-sambino:fix/iterchan-error-event
Open

fix: IterChan.Next returns true on error events without storing a new value#8
childish-sambino wants to merge 1 commit into
Files-com:masterfrom
childish-sambino:fix/iterchan-error-event

Conversation

@childish-sambino

Copy link
Copy Markdown

When a walk worker sends on SendError, Next() stored the error and returned true without storing a new current value. Consumers call Resource() on every iteration (file/uploader.go:176, file/downloader.go:127), so an error event either panics on the nil interface conversion (error before the first file, e.g. a file deleted between ReadDir and stat) or silently processes the previous entry twice.

Next() now records the error for Err() and keeps waiting for the next value or Done, which is the contract consumers already assume (they check it.Err() after the loop). The walker cancels the iterator context on exit (defer it.Stop()), so skipping error events can't hang the loop.

🤖 Generated by Quad tha God

@childish-sambino
childish-sambino marked this pull request as ready for review July 7, 2026 22:26
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.

1 participant