Skip to content

Change omitempty to omitzero on non-pointer API structs #4219

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

Merged
merged 2 commits into from
Jul 24, 2025

Conversation

cbandy
Copy link
Member

@cbandy cbandy commented Jul 24, 2025

The modernize analyzer of gopls recommends this change, and it simplifies some validation tests. The old tag implies +optional for backward compatibility. The new tag does not, so a few fields need the marker.

This eliminates the last results from modernize -test ./...

Checklist:

  • Have you added an explanation of what your changes do and why you'd like them to be included?
  • Have you updated or added documentation for the change, as applicable?
  • Have you tested your changes on all related environments with successful results, as applicable?
    • Have you added automated tests?

Type of Changes:

  • Testing enhancement

Other Information:

Issue: PGO-2582

cbandy added 2 commits July 24, 2025 13:11
The "k8s.io/apimachinery" module does not support "omitzero" until 1.34.

See: kubernetes/kubernetes@41805af
The "modernize" analyzer of "gopls" recommends this change, and it
simplifies some validation tests. The old tag implies "+optional" for
backward compatibility. The new tag does not, so a few fields need the
marker.

Issue: PGO-2582
Copy link
Contributor

@dsessler7 dsessler7 left a comment

Choose a reason for hiding this comment

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

LGTM

@cbandy cbandy merged commit 087c08d into CrunchyData:main Jul 24, 2025
20 checks passed
@cbandy cbandy deleted the modernize branch July 24, 2025 19:50
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.

2 participants