[mobile] cmd/gomobile: correct init command description

1 view
Skip to first unread message

race quite (Gerrit)

unread,
Aug 9, 2026, 3:14:33 PM (15 hours ago) Aug 9
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

race quite has uploaded the change for review

Commit message

cmd/gomobile: correct init command description

The gomobile init command description currently says that it builds
OpenAL for Android. However, init always initializes the gomobile work
directory and installs gobind, while OpenAL is built only when -openal
is specified.

Update the description to reflect its primary initialization behavior
and make the OpenAL step explicitly optional. Regenerate doc.go and add
a regression test for the command description.
Change-Id: Ifc240d184970e6fd49bcf2a064e7dd465f7e85f1

Change diff

diff --git a/cmd/gomobile/doc.go b/cmd/gomobile/doc.go
index c17cf4c..6145bd2 100644
--- a/cmd/gomobile/doc.go
+++ b/cmd/gomobile/doc.go
@@ -24,7 +24,7 @@
bind build a library for Android and iOS
build compile android APK and iOS app
clean remove object files and cached gomobile files
- init build OpenAL for Android
+ init initialize gomobile tools and optionally build OpenAL for Android
install compile android APK and install on device
version print version

@@ -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, -i, -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,9 +138,9 @@

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
+# Initialize gomobile tools and optionally build OpenAL for Android

Usage:

@@ -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, -i, -n, -x, -gcflags, -ldflags, -overlay, -tags, -trimpath,
+and -work are shared with the build command.
For documentation, see 'go help build'.

# Print version
@@ -170,4 +173,4 @@

Version prints versions of the gomobile binary and tools
*/
-package main
+package main // import "golang.org/x/mobile/cmd/gomobile"
diff --git a/cmd/gomobile/init.go b/cmd/gomobile/init.go
index 86f1401..32f156f 100644
--- a/cmd/gomobile/init.go
+++ b/cmd/gomobile/init.go
@@ -28,7 +28,7 @@
run: runInit,
Name: "init",
Usage: "[-openal dir]",
- Short: "build OpenAL for Android",
+ Short: "initialize gomobile tools and optionally build OpenAL for Android",
Long: `
If a OpenAL source directory is specified with -openal, init will
build an Android version of OpenAL for use with gomobile build
diff --git a/cmd/gomobile/init_test.go b/cmd/gomobile/init_test.go
index 0e73717..76a803f 100644
--- a/cmd/gomobile/init_test.go
+++ b/cmd/gomobile/init_test.go
@@ -118,6 +118,12 @@
}
}

+func TestInitHelp(t *testing.T) {
+ if got, want := cmdInit.Short, "initialize gomobile tools and optionally build OpenAL for Android"; got != want {
+ t.Errorf("cmdInit.Short = %q, want %q", got, want)
+ }
+}
+
func diffOutput(got string, wantTmpl *template.Template) (string, error) {
got = filepath.ToSlash(got)

Change information

Files:
  • M cmd/gomobile/doc.go
  • M cmd/gomobile/init.go
  • M cmd/gomobile/init_test.go
Change size: S
Delta: 3 files changed, 23 insertions(+), 14 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: mobile
Gerrit-Branch: master
Gerrit-Change-Id: Ifc240d184970e6fd49bcf2a064e7dd465f7e85f1
Gerrit-Change-Number: 812540
Gerrit-PatchSet: 1
Gerrit-Owner: race quite <quit...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Hajime Hoshi (Gerrit)

unread,
12:20 AM (6 hours ago) 12:20 AM
to race quite, goph...@pubsubhelper.golang.org, Gopher Robot, golang-co...@googlegroups.com
Attention needed from race quite

Hajime Hoshi added 1 comment

File cmd/gomobile/init_test.go
Line 121, Patchset 1 (Latest):func TestInitHelp(t *testing.T) {
Hajime Hoshi . unresolved

This test if meaningless

Open in Gerrit

Related details

Attention is currently required from:
  • race quite
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: mobile
    Gerrit-Branch: master
    Gerrit-Change-Id: Ifc240d184970e6fd49bcf2a064e7dd465f7e85f1
    Gerrit-Change-Number: 812540
    Gerrit-PatchSet: 1
    Gerrit-Owner: race quite <quit...@gmail.com>
    Gerrit-Reviewer: Hajime Hoshi <hajim...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: race quite <quit...@gmail.com>
    Gerrit-Comment-Date: Mon, 10 Aug 2026 04:20:38 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    race quite (Gerrit)

    unread,
    2:34 AM (3 hours ago) 2:34 AM
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from race quite

    race quite uploaded new patchset

    race quite uploaded patch set #2 to this change.
    Open in Gerrit

    Related details

    Attention is currently required from:
    • race quite
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: mobile
    Gerrit-Branch: master
    Gerrit-Change-Id: Ifc240d184970e6fd49bcf2a064e7dd465f7e85f1
    Gerrit-Change-Number: 812540
    Gerrit-PatchSet: 2
    unsatisfied_requirement
    open
    diffy

    race quite (Gerrit)

    unread,
    2:35 AM (3 hours ago) 2:35 AM
    to goph...@pubsubhelper.golang.org, Hajime Hoshi, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Hajime Hoshi

    race quite added 1 comment

    File cmd/gomobile/init_test.go
    Line 121, Patchset 1:func TestInitHelp(t *testing.T) {
    Hajime Hoshi . resolved

    This test if meaningless

    race quite

    Removed the test in patch set 2. Please review again.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hajime Hoshi
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: mobile
      Gerrit-Branch: master
      Gerrit-Change-Id: Ifc240d184970e6fd49bcf2a064e7dd465f7e85f1
      Gerrit-Change-Number: 812540
      Gerrit-PatchSet: 1
      Gerrit-Owner: race quite <quit...@gmail.com>
      Gerrit-Reviewer: Hajime Hoshi <hajim...@gmail.com>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-Attention: Hajime Hoshi <hajim...@gmail.com>
      Gerrit-Comment-Date: Mon, 10 Aug 2026 06:34:55 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Hajime Hoshi <hajim...@gmail.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages