We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version
go version go1.8.3 darwin/amd64
go env
GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/steeve/go" GORACE="" GOROOT="/usr/local/Cellar/go/1.8.3/libexec" GOTOOLDIR="/usr/local/Cellar/go/1.8.3/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bs/51dlb_nn5k35xq9qfsxv9wc00000gn/T/go-build194780881=/tmp/go-build -gno-record-gcc-switches -fno-common" CXX="clang++" CGO_ENABLED="1" PKG_CONFIG="pkg-config" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2"
gomobile bind fails with the following code:
package mypkg import "context" type MyStruct struct { } func NewMyStruct(ctx context.Context) *MyStruct { return nil }
A successful bind.
When trying to build for iOS, this happens:
$ gomobile bind -v -target=ios github.com/steeve/mypkg write /var/folders/bs/51dlb_nn5k35xq9qfsxv9wc00000gn/T/gomobile-work-008978683/src/gomobile_bind/interfaces.go write /var/folders/bs/51dlb_nn5k35xq9qfsxv9wc00000gn/T/gomobile-work-008978683/gen/src/ObjC/interfaces.go write /var/folders/bs/51dlb_nn5k35xq9qfsxv9wc00000gn/T/gomobile-work-008978683/src/gomobile_bind/interfaces.h write /var/folders/bs/51dlb_nn5k35xq9qfsxv9wc00000gn/T/gomobile-work-008978683/src/gomobile_bind/interfaces.m write /var/folders/bs/51dlb_nn5k35xq9qfsxv9wc00000gn/T/gomobile-work-008978683/fakegopath/pkg/darwin_arm/github.com/steeve/mypkg.a write /var/folders/bs/51dlb_nn5k35xq9qfsxv9wc00000gn/T/gomobile-work-008978683/src/gomobile_bind/go_pouetmain.go write /var/folders/bs/51dlb_nn5k35xq9qfsxv9wc00000gn/T/gomobile-work-008978683/src/gomobile_bind/go_main.go write /var/folders/bs/51dlb_nn5k35xq9qfsxv9wc00000gn/T/gomobile-work-008978683/src/iosbin/main.go write /var/folders/bs/51dlb_nn5k35xq9qfsxv9wc00000gn/T/gomobile-work-008978683/src/gomobile_bind/Mypkg.m gomobile: type Context is in package context, which is not bound
This is due to the ctx parameter for the function. It does build for Android, however.
ctx
The text was updated successfully, but these errors were encountered:
So this is because of golang/mobile@e665403 and the fact that the method is named New*. Renaming the method fixes the issue.
New*
However, perhaps it should not fail and rather warn? Not sure about the behaviour.
Sorry, something went wrong.
Change https://golang.org/cl/101115 mentions this issue: bind: skip incompatible constructors in ObjC bindings
bind: skip incompatible constructors in ObjC bindings
golang/mobile@70293e6
cab472b
Fixes golang/go#21523 Change-Id: I1244e296ac4eeb0d10847e73216e4a25a3533292 Reviewed-on: https://go-review.googlesource.com/101115 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2244a47
No branches or pull requests
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
gomobile bind fails with the following code:
What did you expect to see?
A successful bind.
What did you see instead?
When trying to build for iOS, this happens:
This is due to the
ctx
parameter for the function.It does build for Android, however.
The text was updated successfully, but these errors were encountered: