Add omitempty JSON attribute for some fields#9
Merged
thaJeztah merged 1 commit intoopencontainers:mainfrom Apr 12, 2025
Merged
Conversation
thaJeztah
reviewed
Mar 20, 2025
devices/config/device.go
Outdated
|
|
||
| // Uid of the device. | ||
| Uid uint32 `json:"uid"` | ||
| Uid uint32 `json:"uid,omitempty"` //nolint:revive |
Member
There was a problem hiding this comment.
Can you add a comment what the nolint was for?
Suggested change
| Uid uint32 `json:"uid,omitempty"` //nolint:revive | |
| Uid uint32 `json:"uid,omitempty"` //nolint:revive // Ignore false positive that the pod bay door was open |
Contributor
Author
There was a problem hiding this comment.
I actually tried but failed to come up with a nice comment. Something like // Too late to change public API IDs. does not sound good.
This allows to skip marshalling the default/empty/zero values, thus making the resulting JSON smaller. While at it, - ensure the comment is ending with a comma; - add nolint:revive annotations to silence var-naming warnings reported by lint-extra (which thinks it's new code). Alas it is too late to change those names. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Contributor
Author
|
@opencontainers/cgroups-maintainers PTAL (I really would like this to be part of runc 1.3) |
AkihiroSuda
approved these changes
Apr 12, 2025
thaJeztah
approved these changes
Apr 12, 2025
Member
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
sorry, somehow missed your ping 😓
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.
This allows to skip marshalling the default/empty/zero values, thus making the resulting JSON smaller.
While at it, ensure the comment is ending with a comma.
See also: opencontainers/runc#4685