Skip to content
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

Introduce/use JSONFormatToInvalidSignatureError #2518

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

kolyshkin
Copy link
Contributor

Based on a patch from #2512.

Feel free to close if it doesn't make much sense (I'm on the verge).

@kolyshkin kolyshkin mentioned this pull request Aug 15, 2024
Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

I’m not sure this is worth it as such, either, but on balance, let’s do it:

  • The unrelated typo fixes are certainly valuable :)
  • Rule of thumb, “deduplicate when there are 3 copies”
  • Ideally, we’d like some kind of “unmarshaling is an InvalidSignatureError” helper/mix-in, but the only way I know how to do that in Go would be
    type signatureUnmarshaler struct { underlying interface { strictUnmarshalJson(…)…}
    type UntrustedRekorSET { signatureUnmarshaler; … }
    … which costs an extra interface pointer for this.UntrustedRekorSET.signatureUnmarshaler.underlying == this, and doesn’t work at all for UnmarshalJSON because that doesn’t call any construct which would set underlying.

This is a helper to avoid code repetition.

Signed-off-by: Kir Kolyshkin <[email protected]>
@mtrmac mtrmac force-pushed the JSONFormatToInvalidSignatureError branch from f6351fd to a710dc0 Compare August 19, 2024 13:24
@mtrmac mtrmac merged commit 616d1ba into containers:main Aug 19, 2024
10 checks passed
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.

2 participants