Skip to content

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
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