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/cmd/gobind: exported struct can not be used as func parameter #9488

Closed
ChrisSmith opened this issue Jan 2, 2015 · 1 comment
Closed
Milestone

Comments

@ChrisSmith
Copy link

What version of Go are you using
go version devel +c7eb966 Wed Dec 24 07:30:28 2014 +0000 darwin/amd64

What operating system and processor architecture are you using?
osx 10.9.5 cross compiled for arm on Android 5.0.1 Nexus 5

What did you do?
Export a function that takes a struct pointer as a parameter

What did you expect to see?
After reading the supported types section on https://godoc.org/golang.org/x/mobile/cmd/gobind I expected this to be allowed.

What did you see instead?
panic: unsupported seqType: *golang.org/x/mobile/example/libhello/hi.StringStruct / *types.Pointer

To reproduce, modify libhello's hi package like so

package hi

type StringStruct struct {
    Name string
}

func DoIt(ss *StringStruct) {
}

Rest of the panic stack

panic: unsupported seqType: *golang.org/x/mobile/example/libhello/hi.StringStruct / *types.Pointer

goroutine 1 [running]:
golang.org/x/mobile/bind.seqType(0x22084bf9d0, 0x2084de280, 0x0, 0x0)
    /Users/chris/go/src/golang.org/x/mobile/bind/seq.go:63 +0xcfe
golang.org/x/mobile/bind.(*goGen).genFuncBody(0x2084b6ae0, 0x2084e3080, 0x2084de7d8, 0x2)
    /Users/chris/go/src/golang.org/x/mobile/bind/gengo.go:49 +0x12b
golang.org/x/mobile/bind.(*goGen).genFunc(0x2084b6ae0, 0x2084e3080)
    /Users/chris/go/src/golang.org/x/mobile/bind/gengo.go:141 +0x301
golang.org/x/mobile/bind.(*goGen).gen(0x2084b6ae0, 0x0, 0x0)
    /Users/chris/go/src/golang.org/x/mobile/bind/gengo.go:310 +0xa43
golang.org/x/mobile/bind.GenGo(0x22084befb0, 0x2084ec008, 0x2084e2880, 0x2084f71d0, 0x0, 0x0)
    /Users/chris/go/src/golang.org/x/mobile/bind/bind.go:45 +0x1a0
main.genPkg(0x2084b8300)
    /Users/chris/go/src/golang.org/x/mobile/cmd/gobind/gen.go:51 +0x4cb
main.main()
    /Users/chris/go/src/golang.org/x/mobile/cmd/gobind/main.go:34 +0x3ce

goroutine 2 [runnable]:
runtime.forcegchelper()
    /usr/local/go/src/runtime/proc.go:111
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2405 +0x1

goroutine 3 [runnable]:
runtime.bgsweep()
    /usr/local/go/src/runtime/mgc0.go:81
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2405 +0x1

goroutine 4 [runnable]:
runtime.runfinq()
    /usr/local/go/src/runtime/malloc.go:898
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2405 +0x1
@minux minux added this to the Go1.5 milestone Jan 2, 2015
@mikioh mikioh changed the title mobile/gobind: exported struct can not be used as func parameter cmd/gobind: exported struct can not be used as func parameter Jan 4, 2015
hyangah added a commit to golang/mobile that referenced this issue Jan 7, 2015
This change makes gobind to generate proper Go-side proxy code to
handle interface methods that have parameters and return values.

It allows gobind to accept struct pointer types as parameters
or a return value of a method.

Fixes golang/go#9487, golang/go#9488.

Change-Id: Id243c42ee0701d40e3871e392140368c2f8f9bc6
Reviewed-on: https://go-review.googlesource.com/2348
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@hyangah
Copy link
Contributor

hyangah commented Jan 7, 2015

committed the fix; golang/mobile@2b3c966

@hyangah hyangah closed this as completed Jan 7, 2015
@mikioh mikioh changed the title cmd/gobind: exported struct can not be used as func parameter x/mobile/cmd/gobind: exported struct can not be used as func parameter Aug 5, 2015
@golang golang locked and limited conversation to collaborators Aug 5, 2016
@rsc rsc unassigned hyangah Jun 23, 2022
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

4 participants