-
Notifications
You must be signed in to change notification settings - Fork 25
Add omitempty JSON attribute for some fields #9
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
devices/config/device.go
Outdated
|
|
||
| // Uid of the device. | ||
| Uid uint32 `json:"uid"` | ||
| Uid uint32 `json:"uid,omitempty"` //nolint:revive |
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.
Can you add a comment what the nolint was for?
| Uid uint32 `json:"uid,omitempty"` //nolint:revive | |
| Uid uint32 `json:"uid,omitempty"` //nolint:revive // Ignore false positive that the pod bay door was open |
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.
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.
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.
Came up with something; PTAL @thaJeztah
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 <[email protected]>
|
@opencontainers/cgroups-maintainers PTAL (I really would like this to be part of runc 1.3) |
thaJeztah
left a comment
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.
LGTM
sorry, somehow missed your ping 😓
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