Skip to content

Conversation

@bwplotka
Copy link
Contributor

@bwplotka bwplotka commented Apr 11, 2025

Thanks for an amazing project! Go ecosystem struggle (e.g. GoogleCloudPlatform/prometheus-engine#1629) with 3P types that lack a good marshalling practices. Many projects have config structs only designed for parsing. See #306 for the detailed motivation.

Fixes: #306

The feature mechanism is simple -- we ignore struct tag setting for omitempty. We assume it's always 'omitempty' if yaml.OmitEmpty() setting is set.

I confirm:

  • Describe the purpose for which you created this PR.
  • Create test code that corresponds to the modification

Thanks for an amazing project! Go ecosystem struggle (e.g. GoogleCloudPlatform/prometheus-engine#1629)
with 3P types that lack a good marshalling practices. Many project have
config structs only designed for parsing. See goccy#306
for the detailed motivation.

Fixes: goccy#306

The feature mechanism is simple -- we ignore struct tag setting for omitempty.
We assume it's always 'omitempty' if yaml.OmitEmpty() setting is set.

Signed-off-by: bwplotka <[email protected]>
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.89%. Comparing base (ba0598a) to head (968acd5).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #691      +/-   ##
==========================================
+ Coverage   77.87%   77.89%   +0.01%     
==========================================
  Files          22       22              
  Lines        7960     7965       +5     
==========================================
+ Hits         6199     6204       +5     
  Misses       1348     1348              
  Partials      413      413              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@goccy
Copy link
Owner

goccy commented Apr 11, 2025

Thank you for your great PR !!! LGTM 👍

@goccy goccy merged commit ee37df7 into goccy:master Apr 11, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Add global "omitempty" option for encoding

3 participants