Skip to content
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

Fix an inconsistency in MapObjectEncoder #657

Merged
merged 1 commit into from
Apr 29, 2019

Conversation

NWilson
Copy link
Contributor

@NWilson NWilson commented Dec 5, 2018

For some reason, ObjectEncoder has AddBinary and AddByteString methods, but ArrayEncoder only has AppendByteString. This PR adds the missing (forgotten?) AppendBinary method.

Also, I've fixed up a small inconsistency in the MapObjectEncoder that's used in the tests.

Two independent commits - can be reviewed/merged separately (or split into two PRs if you prefer).

@CLAassistant
Copy link

CLAassistant commented Dec 5, 2018

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Dec 5, 2018

Codecov Report

Merging #657 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #657      +/-   ##
==========================================
+ Coverage   97.38%   97.43%   +0.04%     
==========================================
  Files          40       40              
  Lines        2102     2102              
==========================================
+ Hits         2047     2048       +1     
+ Misses         47       46       -1     
  Partials        8        8
Impacted Files Coverage Δ
zapcore/memory_encoder.go 100% <100%> (+1.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67bc79d...2ed8557. Read the comment docs.

Copy link
Contributor

@akshayjshah akshayjshah left a comment

Choose a reason for hiding this comment

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

Thank you for opening this PR! It's been a while since we wrote this code, so I'm honestly not sure why there's no AppendByteString on the PrimitiveArrayEncoder interface. It was probably an oversight - good on you for catching it!

Unfortunately, we can't add this method today, since it breaks backward compatibility. (Adding a method to an interface immediately breaks all third-party implementations of that interface.) I don't want to forget about this, though, so can you please add an item to #388? If we ever accumulate enough changes that we're ready to cut a v2, we'll fix this oversight too.

That said, I would love to pull in your fix to the in-memory encoder. Can you drop the second commit on this PR and fix up the description?

@akshayjshah
Copy link
Contributor

Also, thank you for pitching in to help answer issues. It's immensely helpful.

@NWilson
Copy link
Contributor Author

NWilson commented Jan 22, 2019

Sorry for the long delay, I almost forgot about this! I've removed the ArrayEncoder changes, and put them in a separate PR.

Since you have various "v2" issues queued up, could you make a branch so that you can merge the PRs - and there's no rush to actually finish and release the v2 API.

@NWilson NWilson changed the title A missing (forgotten?) AppendBinary method to ArrayEncoder Fix an inconsistency in MapObjectEncoder Jan 22, 2019
@NWilson
Copy link
Contributor Author

NWilson commented Apr 24, 2019

Ping - I made the changes requested, this PR now only contains the changes that are OK to merge to master.

Copy link
Collaborator

@prashantv prashantv left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for the fix.

@prashantv prashantv merged commit cada3b3 into uber-go:master Apr 29, 2019
lixingwang added a commit to lixingwang/zap that referenced this pull request May 10, 2019
* master:
  README: Switch to travis-ci.com for badge (uber-go#709)
  Fix changelog links for 675
  Prep for 1.10.0 release, update CHANGELOG (uber-go#705)
  Add Go 1.12 for Travis (uber-go#707)
  Fix call depth of standard logger in go1.12 (uber-go#706)
  Fix inconsistency between MapObjectEncoder's AddByteString and AppendByteString (uber-go#657)
  Disable HTMLEscape in reflect JSON encoder (uber-go#704)
cgxxv pushed a commit to cgxxv/zap that referenced this pull request Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants