-
Couldn't load subscription status.
- Fork 18.4k
Open
golang/mobile
#105Labels
FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.mobileAndroid, iOS, and x/mobileAndroid, iOS, and x/mobile
Milestone
Description
Go version
go1.22.4 linux/amd64
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/opt/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/opt/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/go_dist/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/go_dist/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/mobiletest/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2991625483=/tmp/go-build -gno-record-gcc-switches'What did you do?
Using a dummy main.go:
main.go
package mobiletest
func Foo() {
}
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
go mod init mobiletest
go mod vendor
gomobile bind -a -target android .
go get golang.org/x/mobile/bind
What did you see happen?
The above fails with:
"golang.org/x/mobile/bind" is not found; run go get golang.org/x/mobile/bind: no Go package in golang.org/x/mobile/bind
As a workaround, before Go1.22, one could install mobile/bind to $GOPATH and use gomobile bind without modules to side-step this issue completely:
GO111MODULE=off go get -u golang.org/x/mobile/cmd/gomobile
GO111MODULE=off gomobile bind -a -target android .
Since GO 1.22 however, go get is not allowed anymore outside of modules.
What did you expect to see?
No error running gomobile bind.
gomobile bind seems to be unworkable using Go 1.22 when a vendor folder is present. The only workaround seems to be to delete the vendor folder before using gomobile bind.
Related: #34181, but the GO111MODULE=off workaround does not work anymore as of Go 1.22.
Metadata
Metadata
Assignees
Labels
FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.mobileAndroid, iOS, and x/mobileAndroid, iOS, and x/mobile