From 292227240789336b0d054a3ed3ca9a081e1dce55 Mon Sep 17 00:00:00 2001 From: "Hyang-Ah (Hana) Kim" Date: Thu, 5 May 2016 09:22:14 -0700 Subject: [PATCH] cmd/gomobile: error when attempting to bind main package Fixes golang/go#15515 Change-Id: Idc831d4691f6c983d37622bb30c238015542cfdf Reviewed-on: https://go-review.googlesource.com/22802 Reviewed-by: David Crawshaw --- cmd/gomobile/bind.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/gomobile/bind.go b/cmd/gomobile/bind.go index bac5645..8c9df7c 100644 --- a/cmd/gomobile/bind.go +++ b/cmd/gomobile/bind.go @@ -97,6 +97,13 @@ func runBind(cmd *command) error { return err } + // check if any of the package is main + for _, pkg := range pkgs { + if pkg.Name == "main" { + return fmt.Errorf("binding 'main' package (%s) is not supported", pkg.ImportComment) + } + } + switch targetOS { case "android": return goAndroidBind(pkgs, targetArchs)