-
Notifications
You must be signed in to change notification settings - Fork 3.8k
images: use mediatype helpers #9154
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
|
Hi @neersighted. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
I've contained this to the |
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
d438583 to
62f621a
Compare
|
/ok-to-test |
| for _, desc := range eo.manifests { | ||
| switch desc.MediaType { | ||
| case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: | ||
| if images.IsManifestType(desc.MediaType) { |
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.
Alternatively, you could keep a switch, and use the boolean checks in it (I personally find those to be slightly more readable as the condition is more "in plain sight"), but that's really a bike-shed, so just leaving the comment for consideration 😄
switch {
case images.IsManifestType(desc.MediaType):
// ...
case images.IsIndexType(desc.MediaType):
// ...
default:
// ...
}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 tend to prefer the if and braces style for relatively dense blocks like this; unless another review prefers this, I think I'd like to leave this how I have it.

By aligning with the
mediatypes.gohelpers, there is a single source of truth for the mediatype checks in theimages/package tree, and we can remove some case statements. By dropping case statements, branching logic can be simplified and made more obvious, with less nesting.