-
Notifications
You must be signed in to change notification settings - Fork 51
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
Different output when using anonymous fields and omitempty tags #63
Comments
dominicbarnes
added a commit
that referenced
this issue
Mar 1, 2021
Sorry for the late follow-up here, I've been working on a solution to this as we definitely have bugs internally when it comes to the handling of embedded pointers specifically. If you need a workaround right now, embedding the same struct without a pointer works as expected. I'll continue working on a proper solution to this problem in the meantime. |
dominicbarnes
added a commit
that referenced
this issue
Apr 29, 2021
buztard
added a commit
to geekspace9/commercetools-go-sdk
that referenced
this issue
Sep 27, 2021
For maximum compatibility it's used only for unmarshaling at the moment. The existing unit tests look good, benchmarks are promising. name \ time/op bench_encoding_json.txt bench_go_json.txt bench_jsoniter.txt bench_segmentio.txt UnmarshalOrders-8 185ms ± 0% 89ms ± 0% 116ms ± 0% 97ms ± 0% name \ alloc/op bench_encoding_json.txt bench_go_json.txt bench_jsoniter.txt bench_segmentio.txt UnmarshalOrders-8 19.1MB ± 0% 30.7MB ± 0% 27.2MB ± 0% 28.3MB ± 0% name \ allocs/op bench_encoding_json.txt bench_go_json.txt bench_jsoniter.txt bench_segmentio.txt UnmarshalOrders-8 388k ± 0% 335k ± 0% 686k ± 0% 332k ± 0% Using this library for marshaling produces different results from encoding/json due tue the handling of embedded pointers. See segmentio/encoding#63
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I recently tried using your library in one of our software, and I'd like to report an issue that we have when doing so.
The output when calling Marshal on
encoding/json
andsegmentio/encoding/json
differs.I was able to reproduce the error using the following code:
Note that when removing the
omitempty
tag fromMyStruct.MyField
, the output is correct.Segmentio Encoding Version: 0.2.7
Golang Version: 1.15.7
OS: macOS Catalina 10.15.7
The text was updated successfully, but these errors were encountered: