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: Does not work with go.mod replace #27324

Closed
petethepig opened this issue Aug 28, 2018 · 5 comments
Closed

x/mobile: Does not work with go.mod replace #27324

petethepig opened this issue Aug 28, 2018 · 5 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@petethepig
Copy link

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

$ go version
go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/username/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/username/.gvm/pkgsets/go1.11/global"
GOPROXY=""
GORACE=""
GOROOT="/Users/username/.gvm/gos/go1.11"
GOTMPDIR=""
GOTOOLDIR="/Users/username/.gvm/gos/go1.11/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/username/go-project/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/zg/ssp6j1213dg2nd1l8wmc1xs40000gn/T/go-build851930379=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I created a very basic go project that illustrates the issue: https://github.com/petethepig/gomobilebug

There's a go.mod file, notice the use of replace:

module github.com/petethepig/gomobilebug

require (
	github.com/google/netstack v0.0.0
	golang.org/x/mobile v0.0.0-20180808221059-bceb7ef27cc6 // indirect
)

replace github.com/google/netstack v0.0.0 => github.com/petethepig/netstack v0.0.0-20171026205909-b4b77f7e31f6

I run gomobile bind -v -target ios .

What did you expect to see?

I expected the command to succeed.

What did you see instead?

Instead the command throws an error:

$ gomobile bind -v -target ios .
type-checking package "." failed (/Users/username/Dev/st/example/main.go:6:2: could not import github.com/google/netstack/tcpip (type-checking package "github.com/google/netstack/tcpip" failed (/Users/username/.gvm/pkgsets/go1.11/global/pkg/mod/github.com/petethepig/[email protected]/tcpip/tcpip.go:25:2: could not import github.com/google/netstack/tcpip/buffer (cannot find package "github.com/google/netstack/tcpip/buffer" in any of:
	/Users/username/.gvm/gos/go1.11/src/github.com/google/netstack/tcpip/buffer (from $GOROOT)
	/Users/username/.gvm/pkgsets/go1.11/global/src/github.com/google/netstack/tcpip/buffer (from $GOPATH)))))

gomobile: /Users/username/.gvm/pkgsets/go1.11/global/bin/gobind -lang=go,objc -outdir=/var/folders/zg/ssp6j1213dg2nd1l8wmc1xs40000gn/T/gomobile-work-114613772 -tags=ios . failed: exit status 1

It seems like something somewhere fails to properly replace the paths (For example, it searches for github.com/google/netstack/tcpip/buffer package in /Users/username/.gvm/gos/go1.11/src/github.com/google/netstack/tcpip/buffer when it should be searching for it somewhere like /Users/username/.gvm/pkgsets/go1.11/global/pkg/mod/github.com/petethepig/[email protected]/tcpip/buffer.

Unfortunately I am not that familiar with golang codebase so I need help figuring out how to fix this.

@gopherbot gopherbot added this to the Unreleased milestone Aug 28, 2018
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Aug 28, 2018
@petethepig petethepig changed the title x/mobile: Does not work with go modules replace x/mobile: Does not work with go.mod replace Aug 30, 2018
@FiloSottile FiloSottile added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 30, 2018
@FiloSottile
Copy link
Contributor

Looks like a partial duplicate of #27300.

@evenardo
Copy link

'''
env go111module=off gomobile bind
'''
it's will temporarily worked fine

@myitcv
Copy link
Member

myitcv commented Nov 14, 2018

cc @eliasnaur - some time has elapsed since this issue and I'm not sufficiently up to speed to know whether mobile is now modules-aware.

@eliasnaur
Copy link
Contributor

eliasnaur commented Nov 14, 2018 via email

@agnivade
Copy link
Contributor

agnivade commented Feb 3, 2019

Making #27234 as the tracker issue for making gomobile module-aware. Closing this one as this just points out that gomobile is not module-aware.

@agnivade agnivade closed this as completed Feb 3, 2019
@golang golang locked and limited conversation to collaborators Feb 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

7 participants