Skip to content

fix: stop Set.All iteration when requested - #179

Merged
joamaki merged 1 commit into
cilium:mainfrom
immanuwell:fix-set-all-early-stop
Aug 24, 2026
Merged

fix: stop Set.All iteration when requested#179
joamaki merged 1 commit into
cilium:mainfrom
immanuwell:fix-set-all-early-stop

Conversation

@immanuwell

@immanuwell immanuwell commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Set.All() keeps yielding after a caller stops early.
With 2 values, a normal break panics with range function continued iteration after function for loop body returned false

Repro:

for range part.NewSet("first", "second").All() {
	break
}

Before this panics.
After this fix exits cleanly

The iterator now returns when yield is false, with a regression test

Tested with make test, make test-race, make build and make bench

Signed-off-by: immanuwell <pchpr.00@list.ru>
@immanuwell
immanuwell requested a review from a team as a code owner August 23, 2026 14:44
@immanuwell
immanuwell requested review from pippolo84 and removed request for a team August 23, 2026 14:44

@joamaki joamaki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oopsie! Thanks for the fix.

@joamaki
joamaki merged commit 2d522b1 into cilium:main Aug 24, 2026
1 check failed
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.

2 participants