-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pdata] Implement Go 1.23 style iterators #11982
Comments
@yurishkuro good call, will do when we move to minimum supported version to be 1.23 |
I think this is a perfect use case for iterators, the way this is implemented today is quite verbose to write and almost every single use case requires looping over the entries in some way. I suggest we go with an Since this involves changes in autogenerated code, there might be oportunities for reusing existing iterator routines from the standard library, for example |
I started working on this main...mauri870:opentelemetry-collector:pdata-iterator-all. It requires Go 1.23 so we cannot accept it until all the other collector packages are bumped to 1.23. |
Now that the ecosystem moved to Go 1.23 I will resume working on this. I should have a PR up this week. |
Is your feature request related to a problem? Please describe.
Iterating through
pdata
structures today is pretty convoluted, e.g.Describe the solution you'd like
Go 1.23 introduced the ability to use iterators for looping through custom structs. The above code could look like this, if we introduce iterator functions to pdata, e.g.
Seq()
andSeq2()
:The text was updated successfully, but these errors were encountered: