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
encoding/json: Marshaler interface not producing "correct"/desired results #24466
Comments
I want to When I remove
|
When I keep
|
if this is technically correct behaviour, then perhaps for |
Which one is the desired or expected result? |
|
I see. Here's a runnable version on the playground: https://play.golang.org/p/FUBH0ZlswaL. What's happening is It's working correctly given the rules of struct field embedding and |
Given a struct type If your intention to to forward only the fields, but not the methods, you can do this: type aWorker AWorker
type reqUser ReqUser
type AUser struct {
aWorker
reqUser
} Declaring I'm closing this as a duplicate of #22013. |
@dsnet I require the methods to be attached, because |
What you want is currently not possible since you want to forward the fields of Either way, this is still a language issue with embedding and #22013 is the place to rethink embedding for Go2. |
I should also note that this is related to #6213, which may be the reason why you are embedding in the first place. |
The text was updated successfully, but these errors were encountered: