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: custom types mapped to supported types not supported in parameter or return values #27733

Closed
dradtke opened this issue Sep 18, 2018 · 1 comment
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Milestone

Comments

@dradtke
Copy link

dradtke commented Sep 18, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/Users/dradtke/Workspace/go/bin"
GOCACHE="/Users/dradtke/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/dradtke/Workspace/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/w1/f3bh6jkx0vx95g4885d2yr5h3kfr1q/T/go-build388664200=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I attempted to use the gobind tool to generate code for the following example package:

package bindtest

type Number int

func DoSomething(i Number) {
        // do something with i
}

What did you expect to see?

I would expect to see the method DoSomething available in the generated code.

What did you see instead?

The function gets skipped due to an invalid parameter type:

$ gobind -lang go bindtest | grep DoSomething
// skipped function DoSomething with unsupported parameter or result types

The binding works, however, if DoSomething is updated to take an int directly rather than a Number.

@gopherbot gopherbot added this to the Unreleased milestone Sep 18, 2018
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Sep 18, 2018
@dradtke
Copy link
Author

dradtke commented Sep 19, 2018

I actually discovered that custom types do work as long as they use a pointer:

package bindtest

type Number int

func DoSomething(i *Number) {
        // do something with i
}

Therefore I'm closing this as a duplicate of #27691.

@dradtke dradtke closed this as completed Sep 19, 2018
@golang golang locked and limited conversation to collaborators Sep 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

2 participants