Skip to content

Build the Go bindings with the go.mod toolchain - #292

Open
nakulmanimala wants to merge 1 commit into
netbirdio:mainfrom
nakulmanimala:fix/pin-go-toolchain
Open

nakulmanimala wants to merge 1 commit into
netbirdio:mainfrom
nakulmanimala:fix/pin-go-toolchain

Conversation

@nakulmanimala

@nakulmanimala nakulmanimala commented Oct 24, 2026 •

Copy link
Copy Markdown

Fixes #272
Related: netbirdio/netbird#8009

Releases since v0.6.0 crash at launch on 32-bit Android 8–10 (SIGSYS, seccomp blocks futex_time64). The Go bindings are built with Go 1.26.0 instead of the go.mod toolchain go1.26.7: actions/setup-go reads only the go directive, and gomobile bind builds in a temporary module that drops the toolchain directive. Go 1.26.0–1.26.2 have the bug (golang/go#77621).

This exports GOTOOLCHAIN from the submodule's toolchain line in build-android-lib.sh, so CI and local builds both use the pinned release.

Tested:

  • libgojni.so in the v0.6.2 release APK reports go1.26.0. With this change it reports go1.26.7, built with go1.26.0 (as CI installs it) and with go1.25.6 on PATH.
  • Xiaomi Mi TV, Android 10, armeabi-v7a: v0.6.2 crashes on launch; a build with this change starts, logs in and connects.

Summary by CodeRabbit

  • Chores
    • Android library builds now use the Go toolchain version specified by the project when available. When no version is specified, the existing toolchain selection remains unchanged. This affects build consistency rather than app behavior; no user-facing features or changes to the Android app are included in this update.

gomobile bind compiles in a temporary module that keeps the netbird
submodule's go directive (1.26.0) but drops its toolchain directive
(go1.26.7), and actions/setup-go also installs the go-directive release.
Releases since v0.6.0 were therefore built with Go 1.26.0, whose 32-bit
runtime probes futex_time64. The Android 8-10 seccomp filter kills the
app with SIGSYS instead of returning ENOSYS, so armeabi-v7a devices on
those releases crash at launch (golang/go#77621, fixed in Go 1.26.3).

Export GOTOOLCHAIN from the submodule's toolchain directive so every go
invocation, including the one inside gomobile bind, uses the pinned
release, in CI and in local builds alike.

Fixes netbirdio#272

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: f463f6dc-c1e6-4e72-ab9a-deb89dbd7c6d
Commits

Reviewing files that changed from the base of the PR and between f9edcb4 and 3b879f7.

Files selected for processing: 1
  • build-android-lib.sh

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

The Android build script now reads the Go toolchain directive from netbird/go.mod. When present, it exports that value as GOTOOLCHAIN before the gomobile tooling and binding steps.

Changes: Android Go toolchain pin

Layer / File(s) Summary
Toolchain pin and build integration
build-android-lib.sh
Adds pin_go_toolchain to export the toolchain directive from go.mod as GOTOOLCHAIN when present. Calls the function after ensure_ndk and before gomobile tooling and binding.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: pappz

Merge Risk: Minimal · up to 3b879

The toolchain pin is applied correctly before the Android bindings are built, with no identified merge-blocking risk.

Security architecture risk: Minimal · up to 3b879

The change makes Android binding builds use the repository-pinned Go release without adding permissions, changing application trust boundaries, or weakening Android protections. No material security risk introduced or worsened by this change was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed authority is compiler selection within the Android build process, with downstream influence on the generated AAR and packaged applications. The inspected change adds no credential access, IAM permissions, network exposure, or application authorization path.

Trust Boundaries and Controls

  • inferred — Toolchain authority is derived from the checked-out submodule, not a new remote request or user-input channel. The value is exported without shell evaluation. Control of that build input already lies within the repository-controlled source boundary; the inspected change does not establish a new lower-trust path to runner execution.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: building Go bindings with the toolchain specified in go.mod.
Linked Issues check Passed The directly linked open issue is #272. The change reads the NetBird submodule's toolchain directive and exports GOTOOLCHAIN before gomobile bind. This prevents the affected Go 1.26.0–1.26.2 bin…
Out of Scope Changes check Passed The reviewed change adds pin_go_toolchain and calls it before the Go mobile binding build. The function supports the stated Android crash fix because it applies the submodule's pinned Go toolchain t…
Full details: Linked Issues check

Explanation

The directly linked open issue is #272. The change reads the NetBird submodule's toolchain directive and exports GOTOOLCHAIN before gomobile bind. This prevents the affected Go 1.26.0–1.26.2 binding build on 32-bit Android. The PR reports that an Android 10 armeabi-v7a build starts, permits login, and connects. This implements the issue's launch and VPN connection objective. The reported device is a Xiaomi Mi TV, not the Redmi 9C named in #272.

Full details: Out of Scope Changes check

Explanation

The reviewed change adds pin_go_toolchain and calls it before the Go mobile binding build. The function supports the stated Android crash fix because it applies the submodule's pinned Go toolchain to CI and local builds. No unrelated product behavior or unrelated files are included in the supplied change summary.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the toolchain trail,
Then pins the Go version without fail.
Before gomobile starts its flight,
The build steps line up just right.
Soft paws cheer the script tonight.

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android 10] App crashes on startup (black screen) on Xiaomi Redmi 9C

1 participant