fix(go): fix type writing and reading logic in slice #2427
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR investigates and fixes the issue described in #2423.
In the slice serializer, the type marker should be written and read using the correct functions, instead of using typeId directly. Otherwise, struct types may lose type information during serialization.
A test case from issue [Golang] RegisterTagType array of structs #2423 has been added to the language-specific test suite.
In PR #2339 , the dynamic type ID allocation mechanism was temporarily removed to improve cross-language compatibility. However, as mentioned in both that PR and this one, the following problems still remain:
If the slice in issue [Golang] RegisterTagType array of structs #2423 is replaced with an array, the issue still exists. The original case (a slice) is already fixed in this PR.
If the slice element type is changed to a concrete map type, the issue also persists.
As noted in PR perf(Go/python): Type system compatibility upgrade #2339, arrays and slices still have potential problems that can cause issues in cross-language deserialization.
I'm currently working on fixing the above issues in my spare time.
Apologies for the delay.
Related issues
close #2423
Does this PR introduce any user-facing change?
Benchmark