Skip to content

Use reflect to support diff.ApplyConfig with/without gogo's types.Any#75

Merged
dmcgowan merged 1 commit intocontainerd:masterfrom
kzys:imgcrypt-typeurl
Apr 21, 2022
Merged

Use reflect to support diff.ApplyConfig with/without gogo's types.Any#75
dmcgowan merged 1 commit intocontainerd:masterfrom
kzys:imgcrypt-typeurl

Conversation

@kzys
Copy link
Copy Markdown
Member

@kzys kzys commented Apr 20, 2022

containerd is migrating off from github.com/gogo/protobuf
(see containerd/containerd#6564).

However imgcrypt depends containerd and containerd also depends
imgcrypt, which makes changing this signature complicated.

This change workarounds the issue by using Go's reflect package.

@kzys kzys force-pushed the imgcrypt-typeurl branch 7 times, most recently from 16b799b to bfb1fb8 Compare April 20, 2022 18:23
@kzys kzys changed the title Imgcrypt typeurl Use reflect to support diff.ApplyConfig with/without gogo's types.Any Apr 20, 2022
@kzys kzys marked this pull request as ready for review April 20, 2022 18:28
@kzys kzys force-pushed the imgcrypt-typeurl branch from bfb1fb8 to 5d22b93 Compare April 20, 2022 18:37
Copy link
Copy Markdown
Collaborator

@lumjjb lumjjb left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @kzys , have a quick question on one of the tests.

)

func TestInit(t *testing.T) {
if !processorPayloadsUseGogo {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should this be testing against if it is set - only if the precondition is met? I’m not too familiar with the new any types

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right now, because go.mod locks our dependencies and our containerd is 1.6, processorPayloadsUseGogo is always true.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

containerd/containerd#6832 is running processorPayloadsUseGogo=false case.

containerd is migrating off from github.com/gogo/protobuf
(see containerd/containerd#6564).

However imgcrypt depends containerd and containerd also depends
imgcrypt, which makes changing this signature complicated.

This change workarounds the issue by using Go's reflect package.

Signed-off-by: Kazuyoshi Kato <[email protected]>
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.

3 participants