From ee253feddfd08a1b559d4014cbcf8d64cabed937 Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Sat, 22 Aug 2026 21:07:31 +0200 Subject: [PATCH] [misc] Pin the toolchain gomobile init needs for gobind (#7291) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [misc] Let gomobile init fetch the toolchain gobind needs The previous commit's CI run confirmed the failure on a comment-only diff off main, so the cause is not any branch's changes: Android / Build failure iOS / Build failure `gomobile init` re-installs gobind from x/mobile@latest whatever gomobile is pinned to, and setup-go sets GOTOOLCHAIN=local, so the install dies the moment @latest declares a newer Go than go.mod does: gomobile: go install golang.org/x/mobile/cmd/gobind@latest failed: exit status 1 go: golang.org/x/mobile@v0.0.0-20260821190718-4776eadac327 requires go >= 1.26.0 (running go 1.25.12; GOTOOLCHAIN=local) GOTOOLCHAIN=auto on that step alone lets the install fetch what it asks for. Scoped to the step deliberately: the repo's Go version and every build below it stay on go.mod's toolchain, so this buys the mobile jobs nothing except the ability to run gobind. Pinning gobind next to gomobile does not work — init re-installs @latest regardless. A durable fix is to stop `init` reaching the network at all, or to track x/mobile's Go requirement in go.mod; both are larger changes than a red CI warrants right now. --- .github/workflows/mobile-build-validation.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/mobile-build-validation.yml b/.github/workflows/mobile-build-validation.yml index 322f129c9..204576d28 100644 --- a/.github/workflows/mobile-build-validation.yml +++ b/.github/workflows/mobile-build-validation.yml @@ -43,8 +43,19 @@ jobs: run: /usr/local/lib/android/sdk/cmdline-tools/7.0/bin/sdkmanager --install "ndk;23.1.7779620" - name: install gomobile run: go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20251113184115-a159579294ab + # `gomobile init` re-installs gobind from golang.org/x/mobile@latest + # regardless of the pin above (cmd/gomobile/init.go: "Make sure gobind is + # up to date"), so this step resolves a version nobody chose, on every run. + # + # setup-go sets GOTOOLCHAIN=local, so that install fails outright once + # x/mobile@latest declares a newer Go than go.mod does — which it did on + # 2026-08-21, breaking both jobs on every branch at once. GOTOOLCHAIN=auto + # lets this one install fetch the toolchain it asks for. Scoped to the + # step: the repo's own Go version, and every build below, is unaffected. - name: gomobile init run: gomobile init + env: + GOTOOLCHAIN: auto - name: build android netbird lib run: PATH=$PATH:$(go env GOPATH) gomobile bind -o $GITHUB_WORKSPACE/netbird.aar -javapkg=io.netbird.gomobile -ldflags="-checklinkname=0 -X golang.zx2c4.com/wireguard/ipc.socketDirectory=/data/data/io.netbird.client/cache/wireguard -X github.com/netbirdio/netbird/version.version=buildtest" $GITHUB_WORKSPACE/client/android env: @@ -64,8 +75,13 @@ jobs: go-version-file: "go.mod" - name: install gomobile run: go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20251113184115-a159579294ab + # See the Android job: `gomobile init` re-installs gobind from + # golang.org/x/mobile@latest regardless of the pin above, and needs a + # toolchain it may pick newer than go.mod's. - name: gomobile init run: gomobile init + env: + GOTOOLCHAIN: auto - name: build iOS netbird lib run: PATH=$PATH:$(go env GOPATH) gomobile bind -target=ios -bundleid=io.netbird.framework -ldflags="-X github.com/netbirdio/netbird/version.version=buildtest" -o ./NetBirdSDK.xcframework ./client/ios/NetBirdSDK env: