Skip to content
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

x/mobile/bind: gobind does not generate exported symbols which are in embedded structure #13811

Closed
ghost opened this issue Jan 4, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 4, 2016

Given A and B type as below, but gobind does not generate the exported "Connect()" in A's proxy(java).

type B struct {
A
}

func NewB() *B{
return &B{}
}

type A struct {
}

func (a A) Connect() {

}

@hyangah hyangah added this to the Unreleased milestone Jan 15, 2016
@hyangah hyangah changed the title x/mobile/cmd/gobind: gobind does not generate exported symbols which are in embedded structure x/mobile/bind: gobind does not generate exported symbols which are in embedded structure Jan 15, 2016
@hyangah
Copy link
Contributor

hyangah commented Jan 21, 2016

Duplicate of #11318.

Before it being fixed, a workaround is to embed the pointer type.

type B struct {
*A
}

@hyangah hyangah closed this as completed Jan 21, 2016
@ghost
Copy link
Author

ghost commented Jan 26, 2016

Hi hyangah:
Tried your workaround, but another issue has appeared:
It seems that the embedded type should be located at the same package with B ?

error message:
gomobile: type gaia/app.WSClient not defined in package client ("gaia/app/revenge/client")
type gaia/app.WSClient not defined in package client ("gaia/app/revenge/client")

Instead I could use another workaround to solve this issue, although it is not so convenient,
but A and B could be located at different packages.

type B struct {
a other.A
}

type (b *B) Hello() {
a.Hello()
}

type A struct {}

func (a *A) Hello(){}

@golang golang locked and limited conversation to collaborators Feb 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants