Skip to content

Commit 170fa75

Browse files
committed
fix(wgnest): make gomobile bind work in CI (android-release was failing)
The android-release "Build wgnest AAR" step failed with "gomobile: missing golang.org/x/mobile dependency". Two causes: - go.mod had drifted to `go 1.26.5` (a local `go get` bumped it); CI's setup-go is 1.25, so it triggered a toolchain switch that lost the x/mobile tool context. Pin `go 1.25.0` (x/crypto v0.54.0 needs >= 1.25.0; matches CI exactly — no toolchain download). - The go1.24 `tool` directive isn't reliably honored by gomobile bind. Replace it with the classic tools.go blank import (`//go:build tools`), which keeps golang.org/x/mobile a DIRECT dependency on every Go version. Verified: build-android.sh produces wgmobile.aar again, and `go build ./...` (normal, no tools tag) still builds. Same go.mod feeds build-ios.sh, so the iOS xcframework build gets the fix too.
1 parent bd3dd20 commit 170fa75

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

clients/native/wgnest/go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module github.com/runonflux/cumulusvpn-wgnest
22

3-
go 1.26.5
3+
go 1.25.0
44

55
require (
66
golang.org/x/crypto v0.54.0
7+
golang.org/x/mobile v0.0.0-20260709172247-6129f5bee9d5
78
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173
89
)
910

1011
require (
1112
github.com/google/btree v1.0.1 // indirect
12-
golang.org/x/mobile v0.0.0-20260709172247-6129f5bee9d5 // indirect
1313
golang.org/x/mod v0.38.0 // indirect
1414
golang.org/x/net v0.57.0 // indirect
1515
golang.org/x/sync v0.22.0 // indirect
@@ -19,5 +19,3 @@ require (
1919
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
2020
gvisor.dev/gvisor v0.0.0-20230927004350-cbd86285d259 // indirect
2121
)
22-
23-
tool golang.org/x/mobile/cmd/gobind

clients/native/wgnest/tools.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//go:build tools
2+
3+
// This file exists only to keep golang.org/x/mobile in the module's dependency
4+
// graph as a DIRECT requirement, so `gomobile bind` (build-{android,ios}.sh)
5+
// works — gomobile refuses to run if x/mobile isn't a required dependency, and
6+
// nothing else in this module imports it. The classic "tools.go" convention
7+
// (works on every Go version, unlike the go1.24 `tool` directive, which gomobile
8+
// doesn't reliably honor). It is never compiled into any real build (the `tools`
9+
// build tag is never set).
10+
package wgnest
11+
12+
import _ "golang.org/x/mobile/cmd/gobind"

0 commit comments

Comments
 (0)