cmd/gomobile: require -bundleid set for -target=ios
The default, org.golang.todo, is not available outside Google
and the resulting error is confusing.
Fixes golang/go#26615
Change-Id: I417a2f83bc3755628f1f3541a061c9272eb318c0
Reviewed-on: https://go-review.googlesource.com/c/156498
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cmd/gomobile/build.go b/cmd/gomobile/build.go
index 8737210..6f5c7a4 100644
--- a/cmd/gomobile/build.go
+++ b/cmd/gomobile/build.go
@@ -50,8 +50,8 @@
Flag -iosversion sets the minimal version of the iOS SDK to compile against.
The default version is 6.1.
-The -bundleid flag is for -target ios only and sets the bundle ID to use
-with the app; defaults to "org.golang.todo".
+The -bundleid flag is required for -target ios and sets the bundle ID to use
+with the app.
The -o flag specifies the output file name. If not specified, the
output file name depends on the package built.
@@ -134,6 +134,9 @@
}
return nil
}
+ if buildBundleID == "" {
+ return fmt.Errorf("-target=ios requires -bundleid set")
+ }
nmpkgs, err = goIOSBuild(pkg, buildBundleID, targetArchs)
if err != nil {
return err
@@ -240,7 +243,7 @@
cmd.flag.StringVar(&buildGcflags, "gcflags", "", "")
cmd.flag.StringVar(&buildLdflags, "ldflags", "", "")
cmd.flag.StringVar(&buildTarget, "target", "android", "")
- cmd.flag.StringVar(&buildBundleID, "bundleid", "org.golang.todo", "")
+ cmd.flag.StringVar(&buildBundleID, "bundleid", "", "")
cmd.flag.StringVar(&buildIOSVersion, "iosversion", "6.1", "")
cmd.flag.BoolVar(&buildA, "a", false, "")
diff --git a/cmd/gomobile/doc.go b/cmd/gomobile/doc.go
index 059e4d8..7bcbc27 100644
--- a/cmd/gomobile/doc.go
+++ b/cmd/gomobile/doc.go
@@ -106,8 +106,8 @@
Flag -iosversion sets the minimal version of the iOS SDK to compile against.
The default version is 6.1.
-The -bundleid flag is for -target ios only and sets the bundle ID to use
-with the app; defaults to "org.golang.todo".
+The -bundleid flag is required for -target ios and sets the bundle ID to use
+with the app.
The -o flag specifies the output file name. If not specified, the
output file name depends on the package built.