-
Notifications
You must be signed in to change notification settings - Fork 7
fix(payloads)!: fix import and export decoding failures #73
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
base: main
Are you sure you want to change the base?
Conversation
|
Is the issue with Encode/Decode something you encountered only on this type of payload ? |
|
Yes, only on this type of payload |
|
Can it be merged |
| return err | ||
| } | ||
|
|
||
| if d.Tag() == kmip.TagReplaceExisting { |
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.
Suggestion, you can use d.Opt(kmip.TagReplaceExisting, &pl.ReplaceExisting) to reduce the boilerplate
func (dec *Decoder) Opt(tag int, value any) error {
if dec.Tag() == tag {
return dec.TagAny(tag, value)
}
return nil
}| } | ||
| } | ||
| } | ||
| return nil |
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.
Shouldn't it return an error instead if the object-type cannot be found in the attribute list ?
|
Hi @zhangyongding thanks for submitting this change. I made few comments, but looks good overall. Sorry for the delays in reviewing this |
| return err | ||
| } | ||
|
|
||
| for i := range pl.Attribute { |
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 think you do not need to lookup the object type in the attribute list as the type is encoded in the tag of the object struct itself.
No description provided.