reader: unify common code between feed readers#4356
Open
gudvinr wants to merge 3 commits into
Open
Conversation
d3e0fab to
18f8101
Compare
ea92440 to
90880db
Compare
5 tasks
59e281d to
cef05c4
Compare
fguillot
reviewed
Jun 6, 2026
cef05c4 to
7fe5b99
Compare
Every build feed method does similar things in a different way. That makes it harder to read these implementations. Remove nesting creep in loops to make code simpler.
9dbce15 to
c98368c
Compare
Instead of creating unsorted slice and then sorting, just make slice sorted.
c98368c to
a3572f6
Compare
gudvinr
commented
Jun 6, 2026
| label := strings.TrimSpace(category.Label) | ||
| if label != "" { | ||
| labels = append(labels, label) | ||
| func (mcl MediaCategoryList) LabelsSeq() iter.Seq[string] { |
Contributor
Author
There was a problem hiding this comment.
This (and ItunesChannelElement) modification wasn't planned. But I've noticed that these only used once each.
These intermediate slices are unnecessary as they only used to extract .Label (and .Text in case of itunes) from struct.
With iter.Seq we only get label and append to resulting tags slice without creating another slice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I guess different readers were touched by different people in a very different circumstances.
As the result, sometimes code that does exactly the same looks different.
Here, some things were moved around to make code look consistent overall.
I've split everything into different commits but if this PR is too loaded I probably can split them into different PRs if needed. That was done just for the sake of not doing a rebase later.
Not sure how to correctly test for regressions, but I've noticed that only
TestParseEntryWithMediaContentwere failing and it seems like it was relying on the wrong behaviour in first place.Have you followed these guidelines?