From c6da959549601bce003ff9450e843ae4426f205d Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 31 Aug 2019 04:34:43 +0900 Subject: [PATCH] bind/java, bind/objc: do not use module for reverse binding Reverse binding is not available with Go module, and some tests fail due to this. This CL suppresses the errors by disabling Go modules explicitly. Updates golang/go#27234 Change-Id: I7483c1dab468548a2efa05ca426addf5c3d97b6e Reviewed-on: https://go-review.googlesource.com/c/mobile/+/192599 Run-TryBot: Hajime Hoshi Reviewed-by: Bryan C. Mills TryBot-Result: Gobot Gobot --- bind/java/seq_test.go | 6 +++++- bind/objc/seq_test.go | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bind/java/seq_test.go b/bind/java/seq_test.go index 12242aa..8f741c6 100644 --- a/bind/java/seq_test.go +++ b/bind/java/seq_test.go @@ -140,7 +140,11 @@ func runTest(t *testing.T, pkgNames []string, javaPkg, javaCls string) { args = append(args, "-javapkg", javaPkg) } args = append(args, pkgNames...) - buf, err := exec.Command(gomobileBin, args...).CombinedOutput() + cmd := exec.Command(gomobileBin, args...) + // Reverse binding doesn't work with Go module since imports starting with Java or ObjC are not valid FQDNs. + // Disable Go module explicitly until this problem is solved. See golang/go#27234. + cmd.Env = append(os.Environ(), "GO111MODULE=off") + buf, err := cmd.CombinedOutput() if err != nil { t.Logf("%s", buf) t.Fatalf("failed to run gomobile bind: %v", err) diff --git a/bind/objc/seq_test.go b/bind/objc/seq_test.go index 8d247d8..5452461 100644 --- a/bind/objc/seq_test.go +++ b/bind/objc/seq_test.go @@ -129,6 +129,9 @@ func runTest(t *testing.T, pkgNames []string, prefix, testfile, framework string } cmd.Args = append(cmd.Args, pkgNames...) cmd.Dir = filepath.Join(tmpdir, "xcodetest") + // Reverse binding doesn't work with Go module since imports starting with Java or ObjC are not valid FQDNs. + // Disable Go module explicitly until this problem is solved. See golang/go#27234. + cmd.Env = append(os.Environ(), "GO111MODULE=off") buf, err := cmd.CombinedOutput() if err != nil { t.Logf("%s", buf)