cmd/gomobile: remove obsolete -i build flag

The -i flag has been removed from go build, but gomobile still accepts
it for the bind, build, and install commands and passes it to underlying
go build invocations. As a result, using the flag causes the build to
fail.

Remove the flag registration, its shared state, and the code that passes
it to go build. Update the command documentation and regenerate doc.go.

Change-Id: Iba9e176da3852c99ec2854e79eda0d62478187a4
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/812501
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
diff --git a/cmd/gomobile/build.go b/cmd/gomobile/build.go
index c15daa4..8c77235 100644
--- a/cmd/gomobile/build.go
+++ b/cmd/gomobile/build.go
@@ -72,7 +72,7 @@
 
 The -v flag provides verbose output, including the list of packages built.
 
-The build flags -a, -i, -n, -x, -gcflags, -ldflags, -overlay, -tags, -trimpath,
+The build flags -a, -n, -x, -gcflags, -ldflags, -overlay, -tags, -trimpath,
 and -work are shared with the build command. For documentation, see
 'go help build'.
 `,
@@ -234,7 +234,6 @@
 // "Build flags", used by multiple commands.
 var (
 	buildA            bool        // -a
-	buildI            bool        // -i
 	buildN            bool        // -n
 	buildV            bool        // -v
 	buildX            bool        // -x
@@ -264,7 +263,6 @@
 	cmd.flag.IntVar(&buildAndroidAPI, "androidapi", minAndroidAPI, "")
 
 	cmd.flag.BoolVar(&buildA, "a", false, "")
-	cmd.flag.BoolVar(&buildI, "i", false, "")
 	cmd.flag.BoolVar(&buildTrimpath, "trimpath", false, "")
 	cmd.flag.Var(&buildTags, "tags", "")
 }
@@ -316,9 +314,6 @@
 	if buildV {
 		cmd.Args = append(cmd.Args, "-v")
 	}
-	if subcmd != "install" && buildI {
-		cmd.Args = append(cmd.Args, "-i")
-	}
 	if buildX {
 		cmd.Args = append(cmd.Args, "-x")
 	}
diff --git a/cmd/gomobile/doc.go b/cmd/gomobile/doc.go
index c17cf4c..1ccd1d1 100644
--- a/cmd/gomobile/doc.go
+++ b/cmd/gomobile/doc.go
@@ -52,9 +52,10 @@
 the module import wizard (File > New > New Module > Import .JAR or
 .AAR package), and setting it as a new dependency
 (File > Project Structure > Dependencies).  This requires 'javac'
-(version 1.7+) and Android SDK (API level 16 or newer) to build the
-library for Android. The environment variable ANDROID_HOME must be set
-to the path to Android SDK. Use the -javapkg flag to specify the Java
+(version 1.8+) and Android SDK (API level 16 or newer) to build the
+library for Android. The ANDROID_HOME and ANDROID_NDK_HOME environment
+variables can be used to specify the Android SDK and NDK if they are
+not in the default locations. Use the -javapkg flag to specify the Java
 package prefix for the generated classes.
 
 By default, -target=android builds shared libraries for all supported
@@ -72,8 +73,9 @@
 
 The -v flag provides verbose output, including the list of packages built.
 
-The build flags -a, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work
-are shared with the build command. For documentation, see 'go help build'.
+The build flags -a, -n, -x, -gcflags, -ldflags, -overlay, -tags, -trimpath,
+and -work are shared with the build command. For documentation,
+see 'go help build'.
 
 # Compile android APK and iOS app
 
@@ -126,8 +128,9 @@
 
 The -v flag provides verbose output, including the list of packages built.
 
-The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work are
-shared with the build command. For documentation, see 'go help build'.
+The build flags -a, -n, -x, -gcflags, -ldflags, -overlay, -tags, -trimpath,
+and -work are shared with the build command. For documentation, see
+'go help build'.
 
 # Remove object files and cached gomobile files
 
@@ -135,7 +138,7 @@
 
 	gomobile clean
 
-Clean removes object files and cached NDK files downloaded by gomobile init.
+# Clean removes object files and cached NDK files downloaded by gomobile init
 
 # Build OpenAL for Android
 
@@ -158,8 +161,8 @@
 
 Only -target android is supported. The 'adb' tool must be on the PATH.
 
-The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work are
-shared with the build command.
+The build flags -a, -n, -x, -gcflags, -ldflags, -overlay, -tags, -trimpath,
+and -work are shared with the build command.
 For documentation, see 'go help build'.
 
 # Print version
diff --git a/cmd/gomobile/install.go b/cmd/gomobile/install.go
index fd9392c..fb97468 100644
--- a/cmd/gomobile/install.go
+++ b/cmd/gomobile/install.go
@@ -23,7 +23,7 @@
 
 Only -target android is supported. The 'adb' tool must be on the PATH.
 
-The build flags -a, -i, -n, -x, -gcflags, -ldflags, -overlay, -tags, -trimpath,
+The build flags -a, -n, -x, -gcflags, -ldflags, -overlay, -tags, -trimpath,
 and -work are shared with the build command.
 For documentation, see 'go help build'.
 `,
diff --git a/cmd/gomobile/main.go b/cmd/gomobile/main.go
index c123263..a6e7816 100644
--- a/cmd/gomobile/main.go
+++ b/cmd/gomobile/main.go
@@ -156,7 +156,7 @@
 		w.WriteString(cmd.Long)
 	}
 
-	w.WriteString("*/\npackage main // import \"golang.org/x/mobile/cmd/gomobile\"\n")
+	w.WriteString("*/\npackage main\n")
 
 	if err := os.WriteFile(path, w.Bytes(), 0666); err != nil {
 		log.Fatal(err)