-
Notifications
You must be signed in to change notification settings - Fork 594
fix(ui): revert omitzero changes #5035
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
Conversation
| CreationTime time.Time `json:"creationTime,omitempty"` | ||
| AdvanceNoticeDuration time.Duration `json:"advanceNoticeDuration,omitempty"` | ||
| IODrainTimeout time.Duration `json:"ioDrainTimeout,omitempty"` | ||
| StatusPollInterval time.Duration `json:"statusPollInterval,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These do not change behavior, omitempty is ineffective in these cases.
| BeforeFolder *ActionCommand `json:"beforeFolder,omitempty"` | ||
| AfterFolder *ActionCommand `json:"afterFolder,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These do not change behavior: omitempty and omitzero behave the same for pointer types (in the absence of an IsZero() function with the type as a receiver parameter)
There was a problem hiding this 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 reverts JSON struct tag changes from omitzero back to omitempty across policy structures and related types. The changes address issue #5006 by reverting three previous PRs (#4981, #4910, #4907) that introduced omitzero tags. The revert affects JSON serialization behavior for policy structs, ensuring zero values are handled consistently with the standard omitempty tag.
Key Changes:
- Reverted
omitzerotoomitemptyacross all policy-related struct fields - Updated linter configuration to disable the
omitzerocheck in the modernize linter - Modified object and format structs to use
omitemptyconsistently
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| snapshot/policy/upload_policy.go | Reverted JSON tags in UploadPolicy and UploadPolicyDefinition structs |
| snapshot/policy/splitter_policy.go | Reverted JSON tags in SplitterPolicy and SplitterPolicyDefinition structs |
| snapshot/policy/scheduling_policy.go | Reverted JSON tags in SchedulingPolicy and SchedulingPolicyDefinition structs; reordered Manual field |
| snapshot/policy/retention_policy.go | Reverted JSON tags in RetentionPolicy and RetentionPolicyDefinition structs |
| snapshot/policy/policy.go | Reverted JSON tags in top-level Policy and Definition structs |
| snapshot/policy/os_snapshot_policy.go | Reverted JSON tags in OSSnapshotPolicy and VolumeShadowCopyPolicy structs |
| snapshot/policy/logging_policy.go | Reverted JSON tags in LoggingPolicy, DirLoggingPolicy, and EntryLoggingPolicy structs |
| snapshot/policy/files_policy.go | Reverted JSON tags in FilesPolicy and FilesPolicyDefinition structs |
| snapshot/policy/error_handling_policy.go | Reverted JSON tags in ErrorHandlingPolicy and ErrorHandlingPolicyDefinition structs |
| snapshot/policy/compression_policy.go | Reverted JSON tags in CompressionPolicy and MetadataCompressionPolicy structs |
| snapshot/policy/actions_policy.go | Reverted JSON tags in ActionsPolicy and ActionsPolicyDefinition structs |
| snapshot/manifest.go | Added omitempty to ObjectID field in DirEntry; reverted StorageStats fields to omitempty |
| repo/object/indirect.go | Added omitempty to Object field in IndirectObjectEntry |
| repo/format/upgrade_lock_intent.go | Reverted time-related fields to omitempty in UpgradeLockIntent |
| repo/format/content_format.go | Reverted EpochParameters field to omitempty |
| repo/blob/rclone/rclone_options.go | Reverted StartupTimeout field to omitempty |
| .golangci.yml | Disabled omitzero check in modernize linter configuration |
| Manual bool `json:"manual,omitempty"` | ||
| Cron []string `json:"cron,omitempty"` |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Manual field has been moved between NoParentTimesOfDay and Cron, changing the struct field order. This could affect JSON marshaling order and break existing code that relies on struct field positions (e.g., positional initialization). Consider documenting this field reordering if intentional, or restore the original field order.
| Manual bool `json:"manual,omitempty"` | |
| Cron []string `json:"cron,omitempty"` | |
| Cron []string `json:"cron,omitempty"` | |
| Manual bool `json:"manual,omitempty"` |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5035 +/- ##
==========================================
+ Coverage 75.86% 78.03% +2.16%
==========================================
Files 470 548 +78
Lines 37301 31398 -5903
==========================================
- Hits 28299 24501 -3798
+ Misses 7071 4849 -2222
- Partials 1931 2048 +117 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Refs:
modernize:omitzerolinter setting #4981omitzeroJSON tag in policy structs #4910omitzeroJSON tag #4907