Skip to content

Conversation

@ilyam8
Copy link
Member

@ilyam8 ilyam8 commented Jan 8, 2026

Summary

Problem:

The CSVConfig struct was always being marshaled as csv_config: {} in YAML output, even when all configuration fields were empty. This prevented the omitempty tag on the parent ParserConfig.CSV field from working correctly.

Solution:

Created a custom CSVCheckFieldFunc type that implements the IsZeroer interface from the yaml package. By having IsZero() always return true, the function field is treated as empty for omitempty evaluation 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.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 CSVCheckFieldFunc type with an IsZero() method that always returns true
  • Changes the CheckField field type from a raw function type to the new named type
  • Enables proper omitempty behavior for the parent ParserConfig.CSV field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ilyam8 ilyam8 changed the title fix(go.d/pkg/logs): fix CSVConfig omitempty behavior fix(go.d/pkg/logs): fix ParserConfig.CSV omitempty behavior Jan 8, 2026
@ilyam8 ilyam8 enabled auto-merge (squash) January 8, 2026 21:41
@ilyam8 ilyam8 merged commit 0c21979 into netdata:master Jan 8, 2026
121 checks passed
@ilyam8 ilyam8 deleted the fix-go.d-logs-csv-checkfields branch January 9, 2026 00:11
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Jan 9, 2026
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Jan 9, 2026
@stelfrag stelfrag mentioned this pull request Jan 9, 2026
Ferroin pushed a commit that referenced this pull request Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/collectors Everything related to data collection area/go collectors/go.d

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants