Notice: gomobile bind might soon break some Go 1.9 users

117 views
Skip to first unread message

elias...@gmail.com

unread,
Apr 16, 2018, 1:20:33 PM4/16/18
to golang-dev
Hi,

Since subrepos are supposed to work on the current and one release back, I'd like to give notice about a change that might break some Go Mobile users running Go before Go 1.10.1.

I recently submitted https://golang.org/cl/99316 that changed gomobile such that the gobind command could generate standalone and complete bindings to Java and Objc for a set of Go packages. To do that without having the Xcode or Android SDKs present, I also changed gobind to not use the corresponding GOOS (GOOS=android for Android, GOOS=darwin and tag 'ios' for iOS) when go installing the packages to generate for. That's mostly not a problem, except when a Go file contains exported API to generate for and at the same time use Cgo to access platform-specific features. Either gobind will run with CGO_ENABLED=0 and the file will be skipped, or its go install will fail because CC is not set correctly.

I therefore resurrected https://golang.org/cl/99777. The CL changes gobind to use the source importer (importer.For("source", nil), which has FakeImportC set so it will happily process Cgo-using Go files, allowing gobind to run even with a foreign GOOS set.

The source importer was added to Go 1.9 so technically gomobile is compatible with the two latest releases even with 99777 submitted, but the fix for two corner cases in the source importer (https://golang.org/issue/23092 and https://golang.org/issue/24392) is only included from Go 1.10.1.

In summary, gomobile users might have problems generating bindings with Go 1.9 and Go 1.10 if they use testdata directories or relative paths after CL 99777 goes in. I'm not aware of any gomobile users that require Go 1.9.

 - elias
Reply all
Reply to author
Forward
0 new messages