You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
1.8
What operating system and processor architecture are you using (go env)?
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\Software\Go
set GORACE=
set GOROOT=D:\Software\Go
set GOTOOLDIR=D:\Software\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
What did you do?
cmd:
cd golang.org/x/mobile/example/reverse/android
gradle build
The reverse bindings allow access to Java and ObjC APIs by importing
Java/... and Objc/... package from Go. The gobind tool automatically
create the bindings for the API referenced from the packages.
The reverse example takes that ability too far, however. It creates
a circular dependency from the Android databinding layout files to
exported Go types while those same Go types access the Java classes
generated by databinding. It works almost by accident, but not for
newer Gradle versions.
The circular dependencies are bad, but the underlying circular references
created by using the reverse bindings this way are worse. I haven't found
a satisfactory was to avoid retaining references to Go objects from Java
and back without carefully and manually breaking cycles at appropriate
times. One might succeed in ObjC where breaking reference cycles are
already necessary, but not in Java.
The reverse example is a nice technical feat, but promises more than
it can deliver. Delete it.
Fixesgolang/go#19862Fixesgolang/go#18210
Change-Id: Ie6abd2a0ebd4c4ce36339d1294898e15f22f83bd
Reviewed-on: https://go-review.googlesource.com/101155
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
imWildCat
pushed a commit
to imWildCat/go-mobile
that referenced
this issue
Apr 11, 2021
The reverse bindings allow access to Java and ObjC APIs by importing
Java/... and Objc/... package from Go. The gobind tool automatically
create the bindings for the API referenced from the packages.
The reverse example takes that ability too far, however. It creates
a circular dependency from the Android databinding layout files to
exported Go types while those same Go types access the Java classes
generated by databinding. It works almost by accident, but not for
newer Gradle versions.
The circular dependencies are bad, but the underlying circular references
created by using the reverse bindings this way are worse. I haven't found
a satisfactory was to avoid retaining references to Go objects from Java
and back without carefully and manually breaking cycles at appropriate
times. One might succeed in ObjC where breaking reference cycles are
already necessary, but not in Java.
The reverse example is a nice technical feat, but promises more than
it can deliver. Delete it.
Fixesgolang/go#19862Fixesgolang/go#18210
Change-Id: Ie6abd2a0ebd4c4ce36339d1294898e15f22f83bd
Reviewed-on: https://go-review.googlesource.com/101155
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.8
What operating system and processor architecture are you using (
go env
)?set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\Software\Go
set GORACE=
set GOROOT=D:\Software\Go
set GOTOOLDIR=D:\Software\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
What did you do?
cmd:
cd golang.org/x/mobile/example/reverse/android
gradle build
What did you expect to see?
successed to build apk
What did you see instead?
error:
gomobile.exe: loadExportData failed can't find import: golan g.org/x/mobile/example/reverse/reverse
The text was updated successfully, but these errors were encountered: