fix(go.d/pkg/logs): fix ParserConfig.CSV omitempty behavior - #21526
Merged
Conversation
…mitempty behavior
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a YAML marshaling issue where CSVConfig was always serialized as csv_config: {} even when empty, preventing the omitempty tag on the parent ParserConfig.CSV field from working correctly.
Key Changes:
- Introduces a custom
CSVCheckFieldFunctype with anIsZero()method that always returnstrue - Changes the
CheckFieldfield type from a raw function type to the new named type - Enables proper
omitemptybehavior for the parentParserConfig.CSVfield
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ilyam8
enabled auto-merge (squash)
January 8, 2026 21:41
stelfrag
approved these changes
Jan 8, 2026
Merged
Ferroin
pushed a commit
that referenced
this pull request
Jan 12, 2026
(cherry picked from commit 0c21979)
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.
Summary
Problem:
The
CSVConfigstruct was always being marshaled ascsv_config: {}in YAML output, even when all configuration fields were empty. This prevented theomitemptytag on the parentParserConfig.CSVfield from working correctly.Solution:
Created a custom
CSVCheckFieldFunctype that implements theIsZeroerinterface from the yaml package. By havingIsZero()always returntrue, the function field is treated as empty foromitemptyevaluation purposes.Test Plan
Additional Information
For users: How does this change affect me?
Summary by cubic
Fixed CSVConfig YAML omitempty so empty config no longer outputs csv_config: {}. Added CSVCheckFieldFunc with IsZero() to mark CheckField as empty during omitempty evaluation.
Written for commit 7210c07. Summary will update on new commits.