Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile/cmd/gomobile: gomobile bind fails for ambiguous paths #62458

Closed
hajimehoshi opened this issue Sep 5, 2023 · 4 comments
Closed

x/mobile/cmd/gomobile: gomobile bind fails for ambiguous paths #62458

hajimehoshi opened this issue Sep 5, 2023 · 4 comments
Labels
mobile Android, iOS, and x/mobile NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@hajimehoshi
Copy link
Member

What version of Go are you using (go version)?

$ go version
go version go1.20.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hajimehoshi/Library/Caches/go-build"
GOENV="/Users/hajimehoshi/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/hajimehoshi/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/hajimehoshi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/hajimehoshi/test/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/60/khbk2xqn1c5bml1byjn89dwc0000gn/T/go-build2688873579=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Prepare this project

module mobiletest

go 1.20

require golang.org/x/mobile v0.0.0-20230905140555-fbe1c053b6a9

require (
        golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 // indirect
        golang.org/x/image v0.11.0 // indirect
        golang.org/x/sys v0.11.0 // indirect
)
package foo

import (
        _ "golang.org/x/mobile/app"
)

func Dummy() {}

and run

gomobile bind .

The gomoible version is fbe1c053b6a9fb82bd32271219fa206af328fa80
The go.mod is created by go mod tidy and modified to depend on golang.org/x/exp

What did you expect to see?

No error

What did you see instead?

gomobile: go mod tidy failed: exit status 1
go: found mobiletest in mobiletest v0.0.0-00010101000000-000000000000
gobind/gobind imports
        mobiletest imports
        golang.org/x/mobile/app imports
        golang.org/x/exp/shiny/driver/gldriver: ambiguous import: found package golang.org/x/exp/shiny/driver/gldriver in multiple modules:
        golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 (/Users/hajimehoshi/go/pkg/mod/golang.org/x/exp@v0.0.0-20190731235908-ec7cb31e5a56/shiny/driver/gldriver)
        golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 (/Users/hajimehoshi/go/pkg/mod/golang.org/x/exp/shiny@v0.0.0-20230817173708-d852ddb80c63/driver/gldriver)
gobind/gobind imports
        mobiletest imports
        golang.org/x/mobile/app imports
        golang.org/x/exp/shiny/screen: ambiguous import: found package golang.org/x/exp/shiny/screen in multiple modules:
        golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 (/Users/hajimehoshi/go/pkg/mod/golang.org/x/exp@v0.0.0-20190731235908-ec7cb31e5a56/shiny/screen)
        golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 (/Users/hajimehoshi/go/pkg/mod/golang.org/x/exp/shiny@v0.0.0-20230817173708-d852ddb80c63/screen)

https://go-review.googlesource.com/c/mobile/+/525695 is the fix.

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Sep 5, 2023
@gopherbot gopherbot added this to the Unreleased milestone Sep 5, 2023
@gopherbot
Copy link

Change https://go.dev/cl/525695 mentions this issue: cmd/gomobile: add go statements to autogenerated go.mod files

@hajimehoshi
Copy link
Member Author

hajimehoshi commented Sep 5, 2023

Unfortunately, it seems impossible to resolve this go.mod, even though the Go version is specified.

module gobind

go 1.20

replace mobiletest => /Users/hajimehoshi/test/mobiletest

require (
	github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802
	github.com/yuin/goldmark v1.4.13
	golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
	golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56
	golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63
	golang.org/x/image v0.11.0
	golang.org/x/mobile v0.0.0-20230905140555-fbe1c053b6a9
	golang.org/x/mod v0.12.0
	golang.org/x/net v0.6.0
	golang.org/x/sync v0.3.0
	golang.org/x/sys v0.11.0
	golang.org/x/term v0.5.0
	golang.org/x/text v0.12.0
	golang.org/x/tools v0.12.1-0.20230818130535-1517d1a3ba60
	golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
)

@hajimehoshi
Copy link
Member Author

I've confirmed that the 'regular' go.mod (requiring golang.org/x/exp/shiny, not golang.org/x/exp)

module mobiletest

go 1.20

require golang.org/x/mobile v0.0.0-20230905140555-fbe1c053b6a9

require (
	golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 // indirect
	golang.org/x/image v0.11.0 // indirect
	golang.org/x/sys v0.11.0 // indirect
)

also fails to be compiled with the same error. Instead, this can now be compiled with my fix https://go-review.googlesource.com/c/mobile/+/525695. So my fix cannot fix the original issue, but can fix the above issue.

@cherrymui
Copy link
Member

cc @hyangah

@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 5, 2023
hajimehoshi added a commit to hajimehoshi/ebiten that referenced this issue Sep 6, 2023
Now this includes the fix for golang/go#62458.
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants