-
Notifications
You must be signed in to change notification settings - Fork 246
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
fix(go): optional values #2705
fix(go): optional values #2705
Conversation
354dcb7
to
f144831
Compare
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.
LGTM; added "do-not-merge" to let others chime in (@RomainMuller, @iliapolo)
delegate := StructReturningDelegate{expected: &expected} | ||
consumer := calc.NewConsumePureInterface(&delegate) |
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.
Why move the &
from the declaration to the call site?
Also - expected
was intentionally made by-value
in StructReturningDelegate
(this field is unexpected, and it'd be the go-y thing to do here)
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.
There appears to be a bug related to registering managed objects when this is passed by value instead of by reference. The only relevant change here is to the logic within the CastPtrToRef.
This also feels related to #2686 where structs passed by value that are fields of structs, and/or items within a slice, aren't being initialized correctly. Began hunting this down but need some more time.
Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! |
Merging (with squash)... |
Adds support for passing
nil
to jsii nullable types in generated go code.Changes go code generation to always use "pointer types" for all struct fields, method arguments, and method return values. Update runtime type conversion to correctly handle serializing and deserializing to these pointer types where necessary.
Removes unnecessary functionality for resolving scoped interface names for generated go types as each generated type now has only one public name. Adds support for resolving
scopedReferenceName
to easily generate "pointer types" for complex data structures from a type reference.RFC
fix: #2442
fix: #2671
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.