[mobile] cmd/build: -overlay build flag support

2 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
Jan 17, 2026, 4:53:10 PM (16 hours ago) Jan 17
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gerrit Bot has uploaded the change for review

Commit message

cmd/build: -overlay build flag support

Overlay allows for changes to stdlib and runtime.
Change-Id: I1c3b2056f9871be45b870c2325bb96be8a837949
GitHub-Last-Rev: 6514594772a2201a1843375fbf50c721c6d31715
GitHub-Pull-Request: golang/mobile#116

Change diff

diff --git a/cmd/gomobile/build.go b/cmd/gomobile/build.go
index 957da94..c733e2c 100644
--- a/cmd/gomobile/build.go
+++ b/cmd/gomobile/build.go
@@ -71,8 +71,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, -tags, -trimpath, -work,
+and -overlay are shared with the build command. For documentation, see
+'go help build'.
`,
}

@@ -248,6 +249,7 @@
buildIOSVersion string // -iosversion
buildAndroidAPI int // -androidapi
buildTags stringsFlag // -tags
+ buildOverlay string // -overlay
)

func addBuildFlags(cmd *command) {
@@ -258,6 +260,7 @@
cmd.flag.StringVar(&buildBundleID, "bundleid", "", "")
cmd.flag.StringVar(&buildIOSVersion, "iosversion", "13.0", "")
cmd.flag.IntVar(&buildAndroidAPI, "androidapi", minAndroidAPI, "")
+ cmd.flag.StringVar(&buildOverlay, "overlay", "", "")

cmd.flag.BoolVar(&buildA, "a", false, "")
cmd.flag.BoolVar(&buildI, "i", false, "")
@@ -327,6 +330,9 @@
if buildLdflags != "" {
cmd.Args = append(cmd.Args, "-ldflags", buildLdflags)
}
+ if buildOverlay != "" {
+ cmd.Args = append(cmd.Args, "-overlay", buildOverlay)
+ }
if buildTrimpath {
cmd.Args = append(cmd.Args, "-trimpath")
}

Change information

Files:
  • M cmd/gomobile/build.go
Change size: S
Delta: 1 file changed, 8 insertions(+), 2 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: I1c3b2056f9871be45b870c2325bb96be8a837949
Gerrit-Change-Number: 737300
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
Jan 17, 2026, 4:53:13 PM (16 hours ago) Jan 17
to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gopher Robot added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Gopher Robot . unresolved

I spotted some possible problems with your PR:

  1. The first word in the commit title after the package should be a lowercase English word (usually a verb).
2. You usually need to reference a bug number for all but trivial or cosmetic fixes. For the mobile repo, the format is usually 'Fixes golang/go#12345' or 'Updates golang/go#12345' at the end of the commit message. Should you have a bug reference?

Please address any problems by updating the GitHub PR.

When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above. These findings are based on heuristics; if a finding does not apply, briefly reply here saying so.

To update the commit title or commit message body shown here in Gerrit, you must edit the GitHub PR title and PR description (the first comment) in the GitHub web interface using the 'Edit' button or 'Edit' menu entry there. Note: pushing a new commit to the PR will not automatically update the commit message used by Gerrit.

For more details, see:

(In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

Open in Gerrit

Related details

Attention set is empty
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: I1c3b2056f9871be45b870c2325bb96be8a837949
    Gerrit-Change-Number: 737300
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Comment-Date: Sat, 17 Jan 2026 21:53:09 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Gopher Robot (Gerrit)

    unread,
    Jan 17, 2026, 4:55:40 PM (16 hours ago) Jan 17
    to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Message from Gopher Robot

    Congratulations on opening your first change. Thank you for your contribution!

    Next steps:
    A maintainer will review your change and provide feedback. See
    https://go.dev/doc/contribute#review for more info and tips to get your
    patch through code review.

    Most changes in the Go project go through a few rounds of revision. This can be
    surprising to people new to the project. The careful, iterative review process
    is our way of helping mentor contributors and ensuring that their contributions
    have a lasting impact.

    Open in Gerrit

    Related details

    Attention set is empty
    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: I1c3b2056f9871be45b870c2325bb96be8a837949
    Gerrit-Change-Number: 737300
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Comment-Date: Sat, 17 Jan 2026 21:55:35 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Murtaza Aliakbar (Gerrit)

    unread,
    Jan 17, 2026, 5:00:58 PM (16 hours ago) Jan 17
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Hajime Hoshi, Dmitri Shuralyov, Hyang-Ah Hana Kim, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Dmitri Shuralyov and Hajime Hoshi

    Murtaza Aliakbar added 1 comment

    Patchset-level comments
    Murtaza Aliakbar . unresolved

    The -overlay flag comes in handy when trying to change the behaviour of the Go runtime on platforms like Android.

    For instance: Applying patches to change behaviour of Timers, like done by WireGuard https://github.com/WireGuard/wireguard-android/blob/09b75c2bd37f749e2a8c85876394854113c74be7/tunnel/tools/libwg-go/goruntime-boottime-over-monotonic.diff

    (the diff could be patching stdlib/runtime at build time with https://github.com/felixge/go-patch-overlay, if gomobile supported -overlay)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dmitri Shuralyov
    • Hajime Hoshi
    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: I1c3b2056f9871be45b870c2325bb96be8a837949
    Gerrit-Change-Number: 737300
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Reviewer: Hajime Hoshi <hajim...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-CC: Murtaza Aliakbar <mur...@gmail.com>
    Gerrit-Attention: Hajime Hoshi <hajim...@gmail.com>
    Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Comment-Date: Sat, 17 Jan 2026 22:00:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Hajime Hoshi (Gerrit)

    unread,
    Jan 17, 2026, 11:41:46 PM (9 hours ago) Jan 17
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Dmitri Shuralyov, Hyang-Ah Hana Kim, Murtaza Aliakbar, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Dmitri Shuralyov

    Hajime Hoshi added 1 comment

    File cmd/gomobile/build.go
    Line 75, Patchset 1 (Latest):and -overlay are shared with the build command. For documentation, see
    Hajime Hoshi . unresolved

    Let's keep the alphabetical order like `-a, -i, -n, -x, -gcflags, -ldflags, -overlay, -tags, -trimpath, and -work`.

    Also, Update bind.go too.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dmitri Shuralyov
    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: I1c3b2056f9871be45b870c2325bb96be8a837949
    Gerrit-Change-Number: 737300
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Reviewer: Hajime Hoshi <hajim...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-CC: Murtaza Aliakbar <mur...@gmail.com>
    Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Comment-Date: Sun, 18 Jan 2026 04:41:38 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages