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: gomobile bind fails with target=ios because of interface func #12403

Closed
diegostamigni opened this issue Aug 30, 2015 · 3 comments

Comments

@diegostamigni
Copy link

While doing some experiments with gomobile targeting iOS, I'm getting an error while trying to bind an interface like so:

type Parsable interface {
    FromJSON(jstr string) string
    ToJSON() (string, error)
}

The bind fails as shown below:

osiris$ gomobile bind -target=ios 
gomobile: darwin-armv7: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -I . -g -O2 -o gobind-scriba-arm.o -c GoScriba.m -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -arch armv7 failed: exit status 1
GoScriba.m:125:6: error: expected '(' after 'if'
                if [(id<NSObject>)(ret0_) isKindOfClass:[NSString* class]]) {
                   ^
1 error generated.

The problem is related to any function that returns a pair of (_any_type, error) AND if is in an interface:

type Foo interface {
    Bar(str string) (string, error)
}

System info:

osiris$ go version
go version go1.5 darwin/amd64

osiris$ gomobile version
gomobile version +1b518ad Fri Aug 28 15:23:09 2015 +0000 (android,ios); androidSDK=/Users/osiris/Library/Android/sdk/platforms/android-22
@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Aug 30, 2015
@ianlancetaylor ianlancetaylor changed the title gomobile bind fails with target=ios because of interface func x/tools/mobile: gomobile bind fails with target=ios because of interface func Aug 30, 2015
@ianlancetaylor
Copy link
Contributor

CC @crawshaw

@mikioh mikioh changed the title x/tools/mobile: gomobile bind fails with target=ios because of interface func x/mobile/bind: gomobile bind fails with target=ios because of interface func Aug 31, 2015
@gopherbot
Copy link

CL https://golang.org/cl/14077 mentions this issue.

@diegostamigni
Copy link
Author

Bug fixed (ref. https://go-review.googlesource.com/#/c/14077)

hyangah added a commit to golang/mobile that referenced this issue Sep 1, 2015
Fixes golang/go#12403

Change-Id: I9b8e6d69beb1ceb27e991348212acb5054497e47
Reviewed-on: https://go-review.googlesource.com/14077
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@golang golang locked and limited conversation to collaborators Sep 4, 2016
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Fixes golang/go#12403

Change-Id: I9b8e6d69beb1ceb27e991348212acb5054497e47
Reviewed-on: https://go-review.googlesource.com/14077
Reviewed-by: David Crawshaw <crawshaw@golang.org>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Fixes golang/go#12403

Change-Id: I9b8e6d69beb1ceb27e991348212acb5054497e47
Reviewed-on: https://go-review.googlesource.com/14077
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@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