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

Backport to v1: Prevent "Any" fields from pointing to *interface{} #1591

Merged
merged 2 commits into from Mar 14, 2018

Conversation

Projects
None yet
2 participants
@xoob
Copy link
Contributor

xoob commented Mar 14, 2018

This is a backport of the bugfix from master #1584 (86448e9) to the v1 stable branch, as requested by @raphael.


We fix an issue where non-required fields of kind "Any" were generated
as a pointer to *interface{}. This broke the Go compiler which failed
with the error "type *interface {} is pointer to interface, not
interface".

To prevent this, we teach AttributeDefinition.IsPrimitivePointer that
AnyKind should never be converted to a pointer, since it already is an
interface. The change also adds a test case.

This is a backport of #1584 to the "v1" stable branch.

xoob added some commits Mar 12, 2018

Prevent "Any" fields from pointing to *interface{}
We fix an issue where non-required fields of kind "Any" were generated
as a pointer to *interface{}. This broke the Go compiler which failed
with the error "type *interface {} is pointer to interface, not
interface".

To prevent this, we teach AttributeDefinition.IsPrimitivePointer that
AnyKind should never be converted to a pointer, since it already is an
interface. The change also adds a test case.

This is a backport of #1584 to the "v1" stable branch.
@raphael

This comment has been minimized.

Copy link
Member

raphael commented Mar 14, 2018

Thank you!

@raphael raphael merged commit 10dcae6 into goadesign:v1 Mar 14, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

xoob added a commit to xoob/goa that referenced this pull request Mar 18, 2018

Prevent pointer to '*interface{}' in user types
A previous patch in [goadesign#1591][1] addressed an issue where optional fields
of kind "Any" would result in a pointer to interface. We fix an
additional occurence of this problem in private user types, which follow
slightly different logic than the public media types previously fixed
and add a test case for private defs.

[1]: goadesign#1591

xoob added a commit to xoob/goa that referenced this pull request Mar 18, 2018

Prevent pointer to '*interface{}' in user types
A previous patch in [goadesign#1591][1] addressed an issue where optional fields
of kind "Any" would result in a pointer to interface. We fix an
additional occurence of this problem in private user types, which follow
slightly different logic than the public media types previously fixed
and add a test case for private defs.

[1]: goadesign#1591

raphael added a commit that referenced this pull request Mar 19, 2018

Prevent pointer to '*interface{}' in user types (#1610)
* Add tests for private user type gen

* Prevent pointer to '*interface{}' in user types

A previous patch in [#1591][1] addressed an issue where optional fields
of kind "Any" would result in a pointer to interface. We fix an
additional occurence of this problem in private user types, which follow
slightly different logic than the public media types previously fixed
and add a test case for private defs.

[1]: #1591

raphael added a commit that referenced this pull request Mar 19, 2018

v1: Prevent pointer to '*interface{}' in user types (#1611)
* Add tests for private user type gen

* Prevent pointer to '*interface{}' in user types

A previous patch in [#1591][1] addressed an issue where optional fields
of kind "Any" would result in a pointer to interface. We fix an
additional occurence of this problem in private user types, which follow
slightly different logic than the public media types previously fixed
and add a test case for private defs.

[1]: #1591

@jiekang jiekang referenced this pull request Jul 13, 2018

Closed

Add 1.x.y release tag #1807

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment