-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Enable Marshaling support #5
Open
eduncan911
wants to merge
8
commits into
release-2.0.0
Choose a base branch
from
feature-Enable-Unmarshaling-Support
base: release-2.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
Merged
79dae0e
to
eaeee5d
Compare
Repository owner
deleted a comment from
coveralls
Jul 3, 2017
eduncan911
added a commit
that referenced
this pull request
Feb 7, 2020
# This is the 1st commit message: Go Mod and Vendor # This is the commit message #2: asd # This is the commit message #3: asd # This is the commit message #4: asd # This is the commit message #5: asd # This is the commit message #6: asd # This is the commit message #7: asd # This is the commit message #8: asd # This is the commit message #9: asd
This was referenced Oct 28, 2020
91f287b
to
8bcde0c
Compare
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.
Note, this PR is incomplete. Still needs:
I am creating this PR early in transparency for others to see and comment on while work continues.
Backwards Compatibility
While this is targeting a 2.x point release, I am trying to keep it backwards compatible with the existing 1.x releases.
So far it remains backwards compatible as long as you used the API methods in 1.x (
podcast.New(...)
,p.AddItem(...)
,i.AddEnclosure(...)
, etc etc). These do not change at all from outside perspective, validated by all unit and integration tests (100% code coverage baby!).What does break is the removal of specialized fields that were suffixed with "Formatted." For example,
Enclosure.TypeFormatted
,Enclosure.LengthFormatted
,Item.AuthorFormatted
,Item.PudDateFormatted
and so on. They are all now removed. These were originally added because, frankly, I was too lazy to implement theMarshal
interfaces when I originally wrote it - it was a simple hack to just use a 2nd field and manipulate the result during the API calls. These were only used if you bypassed the API methods and attempted to manipulate the Podcast feeds yourself.So basically, if you stuck to the API methods you were fine. But, if you used the structs only and did everything manually, you could see some code breakage.
Marshaling
I actually came up with a use case lately that I needed to compare previous feeds with newly generated ones (to limit updates). Therefore, I needed a way to read my old generated feed and compare it to the new feed - while ignoring things like PubDate that changes on every invocation. To do this I needed to read an existing feed - and what better way to do this, than when this Podcast package!
Except, it didn't work... I left out some common Marshaling requirements such as XMLName-ing the nil-able fields of structs and had a lot of custom marshaling going on with the Formatted fields.
With the changes to use the
Marshaler
andUnmarshaler
interfaces, I needed to remove those "Formatted" fields. I think this was enough to warrant a full on code review and Major release bump to 2.x.A bit of Freedom Removed
This unfortunately creates a delima: you no longer have full control over your Feed with the removal of the plaintext "Formatted"
string
fields from the structs, and the move to useMarshaler
andUnmarshaler
interfaces. Now, you must use the structs and set items with strongly-typed objects.To me, this is a no brainer - i want the
Marshaler
andUnmarshaler
interfaces to handle compliant feeds as well as strongly-typed objects.But to others that wanted complete control over their feeds, with non-compliant specially "Formatted" fields such as their own PubDate format, this 2.x breaks that ability.
I believe this is ok. But, I am open to discussions here.
Too Strict on
Enclosure.EnclosureType
?Unmarshaling, where we had none before have you, is implemented in a very strict nature with this version.
See the large comment block in
enclosure.go
line L122: https://github.com/eduncan911/podcast/compare/develop...feature-Enable-Unmarshaling-Support?expand=1#diff-b2f071ccd78abc2ac116c7a8665bde7eR122For now, I am keeping it strict. Feel free to discuss.