Skip to content

Added Config.AllowOmitEmptyStruct #460

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

millerlogic
Copy link

Optionally allow omitempty to apply to an empty (zero value) struct, disabled by default.
Useful when there are a lot of empty structs that are often not used. I am not a fan of using pointers just for this side effect.
I can add tests if there is interest.

@codecov
Copy link

codecov bot commented May 17, 2020

Codecov Report

Merging #460 into master will decrease coverage by 0.14%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #460      +/-   ##
==========================================
- Coverage   86.61%   86.47%   -0.15%     
==========================================
  Files          41       41              
  Lines        5103     5109       +6     
==========================================
- Hits         4420     4418       -2     
- Misses        542      550       +8     
  Partials      141      141              
Impacted Files Coverage Δ
reflect_struct_encoder.go 81.45% <55.55%> (-2.59%) ⬇️
config.go 89.41% <100.00%> (+0.05%) ⬆️
reflect_struct_decoder.go 84.55% <0.00%> (-0.54%) ⬇️

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 55287ed...d32e273. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant