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 <crawshaw@golang.org>
This commit is contained in:
Hyang-Ah (Hana) Kim 2016-05-05 09:22:14 -07:00 committed by Hyang-Ah Hana Kim
parent c435d0bad5
commit 2922272407
1 changed files with 7 additions and 0 deletions

View File

@ -97,6 +97,13 @@ func runBind(cmd *command) error {
return err 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 { switch targetOS {
case "android": case "android":
return goAndroidBind(pkgs, targetArchs) return goAndroidBind(pkgs, targetArchs)