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 version shows error #34676

Closed
mandelmonkey opened this issue Oct 3, 2019 · 15 comments
Closed

x/mobile/cmd/gomobile: gomobile version shows error #34676

mandelmonkey opened this issue Oct 3, 2019 · 15 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@mandelmonkey
Copy link

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

go1.13 darwin/amd64

$ go version

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/chris/Library/Caches/go-build"
GOENV="/Users/chris/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/chris/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"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/chris/go/src/github.com/lightningnetwork/lnd/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/rp/f7xqr7490tb5_98n7cjvxsx80000gn/T/go-build815709937=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

ran gomobile version after go get golang.org/x/mobile/cmd/gomobile go init

What did you expect to see?

the version number

What did you see instead?

gomobile version gomobile version unknown: mobile repo git log failed: exit status 128, fatal: not a git repository (or any of the parent directories): .git

@hyangah
Copy link
Contributor

hyangah commented Oct 3, 2019

This seems to be another part of gomobile that does not work with the workflow assumed in the module mode. For version, it assumes there is a git repository checked out under GOPATH, which is no longer true in the module mode.

@mandelmonkey What will happen if it is built with GOPATH mode?

GO111MODULE=off go get golang.org/x/mobile/cmd/gomobile

@andybons andybons added mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Oct 3, 2019
@andybons andybons added this to the Unplanned milestone Oct 3, 2019
@andybons andybons added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Oct 3, 2019
@andybons andybons changed the title gomobile version shows error x/mobile/cmd/gomobile: gomobile version shows error Oct 3, 2019
@mandelmonkey
Copy link
Author

@hyangah I get package golang.org/x/mobile/cmd/gomobile: cannot find package "golang.org/x/mobile/cmd/gomobile" in any of: /usr/local/go/src/golang.org/x/mobile/cmd/gomobile (from $GOROOT) /Users/chris/go/src/golang.org/x/mobile/cmd/gomobile (from $GOPATH)

@hyangah
Copy link
Contributor

hyangah commented Oct 3, 2019

I cannot reproduce it.
@mandelmonkey Have you checked if go get fetched the source file in your $GOPATH/src/.. directory? Or is your $GOPATH not writable?

$ GOPATH=`mktemp -d` GO111MODULE=off go get -x -v golang.org/x/mobile/cmd/gomobile
# get https://golang.org/x/mobile/cmd/gomobile?go-get=1
# get //golang.org/x/mobile/cmd/gomobile?go-get=1: 200 OK (0.158s)
get "golang.org/x/mobile/cmd/gomobile": found meta tag get.metaImport{Prefix:"golang.org/x/mobile", VCS:"git", RepoRoot:"https://go.googlesource.com/mobile"} at //golang.org/x/mobile/cmd/gomobile?go-get=1
get "golang.org/x/mobile/cmd/gomobile": verifying non-authoritative meta tag
# get https://golang.org/x/mobile?go-get=1
# get //golang.org/x/mobile?go-get=1: 200 OK (0.034s)
golang.org/x/mobile (download)
cd .
git clone -- https://go.googlesource.com/mobile /tmp/tmp.SuniQO4FKr/src/golang.org/x/mobile
cd /tmp/tmp.SuniQO4FKr/src/golang.org/x/mobile
git submodule update --init --recursive
cd /tmp/tmp.SuniQO4FKr/src/golang.org/x/mobile
git show-ref
cd /tmp/tmp.SuniQO4FKr/src/golang.org/x/mobile
git submodule update --init --recursive
WORK=/tmp/go-build927349826
golang.org/x/mobile/internal/binres
mkdir -p $WORK/b097/
cat >$WORK/b097/importcfg << 'EOF' # internal
...
mv $WORK/b001/exe/a.out /tmp/tmp.SuniQO4FKr/bin/gomobile
rm -r $WORK/b001/

@mandelmonkey
Copy link
Author

@hyangah so the error says cannot find package "golang.org/x/mobile/cmd/gomobile" in any of: /usr/local/go/src/golang.org/x/mobile/cmd/gomobile

but I dont have go installed in the /usr/local/ directory is is in the go is installed in /Users/chris/

I need to install go globally?

@hyangah
Copy link
Contributor

hyangah commented Oct 3, 2019

@mandelmonkey No. /usr/local/go/ is your GOROOT which you don't ever want to have gomobile source code at all. The second one (/Users/chris/go/...) is from your default GOPATH. Please check whether go get successfully cloned the git repo under /Users/chris/go/src/golang.org/x/mobile/. go get -x -v will show the details.

@mandelmonkey
Copy link
Author

mandelmonkey commented Oct 3, 2019

@hyangah
here are the results

chris$ GO111MODULE=off go get  -x -v golang.org/x/mobile/cmd/gomobile
package  -x:  -x: invalid import path: malformed import path "\u00a0-x": invalid char '\u00a0'
package -v: -v: invalid import path: malformed import path "-v": leading dash
package golang.org/x/mobile/cmd/gomobile: cannot find package "golang.org/x/mobile/cmd/gomobile" in any of:
	/usr/local/go/src/golang.org/x/mobile/cmd/gomobile (from $GOROOT)
	/Users/chris/go/src/golang.org/x/mobile/cmd/gomobile (from $GOPATH)

and here is the directory under /Users/chris/go/src/golang.org/x/mobile/.

 Christians-MacBook-Pro:go chris$ ls /Users/chris/go/src/golang.org/x/mobile/.
AUTHORS		LICENSE		app		cmd		event		geom		go.sum
CONTRIBUTING.md	PATENTS		asset		codereview.cfg	example		gl		internal
CONTRIBUTORS	README.md	bind		doc		exp		go.mod		testdata
 


@hyangah
Copy link
Contributor

hyangah commented Oct 3, 2019

Some strange shell issue? -x and -v are valid flags and it seems that it's not recognized.

@mandelmonkey
Copy link
Author

hmm not sure, something changed I get Christians-MacBook-Pro:go chris$ gomobile version gomobile version unknown: binary is out of date, re-install it now a few other coworkers have the same issue, is it a MACOS thing?

@hyangah
Copy link
Contributor

hyangah commented Oct 3, 2019

Again try
GO111MODULE=off gomobile version

Or go to an empty directory and run gomobile version.
From your go env output, I guess the go command is operating in module mode due to the presence of a go.mod file.

This time, try to avoid copy and paste. Seems like the copy-and-paste inserted extra characters like non-breaking space characters.

@mandelmonkey
Copy link
Author

no prob, I tried again Again try GO111MODULE=off gomobile version

And got

Christians-MacBook-Pro:~ chris$ GO111MODULE=off gomobile version
gomobile version unknown: cannot test gomobile binary: exit status 1, can't load package: package golang.org/x/mobile/cmd/gomobile: cannot find package "golang.org/x/mobile/cmd/gomobile" in any of:
	/usr/local/go/src/golang.org/x/mobile/cmd/gomobile (from $GOROOT)
	/Users/chris/go/src/golang.org/x/mobile/cmd/gomobile (from $GOPATH)

moved to an empty directory and ran these

Christians-MacBook-Pro:empty chris$ GO111MODULE=off gomobile version
gomobile version unknown: cannot test gomobile binary: exit status 1, can't load package: package golang.org/x/mobile/cmd/gomobile: cannot find package "golang.org/x/mobile/cmd/gomobile" in any of:
	/usr/local/go/src/golang.org/x/mobile/cmd/gomobile (from $GOROOT)
	/Users/chris/go/src/golang.org/x/mobile/cmd/gomobile (from $GOPATH)

Christians-MacBook-Pro:empty chris$ gomobile version
gomobile version unknown: cannot test gomobile binary: exit status 1, can't load package: package golang.org/x/mobile/cmd/gomobile: cannot find package "golang.org/x/mobile/cmd/gomobile" in any of:
	/usr/local/go/src/golang.org/x/mobile/cmd/gomobile (from $GOROOT)
	/Users/chris/go/src/golang.org/x/mobile/cmd/gomobile (from $GOPATH)

Christians-MacBook-Pro:empty chris$ export GO111MODULE=on
Christians-MacBook-Pro:empty chris$ gomobile version
gomobile version unknown: binary is out of date, re-install it
Christians-MacBook-Pro:empty chris$ 

@daluu
Copy link

daluu commented Mar 24, 2020

Maybe try go get golang.org/x/mobile/cmd/gomobile again from outside any directory that has go.mod. Then run gomobile version from any path. It could be you have to rebuild the binary because it wasn't installed correctly the first time (e.g. fetched from a directory that has go.mod in it).

@apmattil
Copy link

looks like only way I can version is to do outside off my app dir (containing go.mod)

GO111MODULE=off go get -x -v -u golang.org/x/mobile/cmd/gomobile
GO111MODULE=off /home/go/go/bin/gomobile version

when I check version at my app dir :
$ GO111MODULE=on /home/go/go/bin/gomobile version
gomobile version unknown: binary is out of date, re-install it

and again with without modules:
$ GO111MODULE=off /home/go/go/bin/gomobile version
gomobile version +973feb4 Sat Aug 1 11:21:45 2020 +0000 (android); androidSDK=/home/go/Android/Sdk/platforms/android-30

@lance6716
Copy link

also error in my project, where I just installed gomobile

$ go install golang.org/x/mobile/cmd/gomobile@latest
go: downloading golang.org/x/mobile v0.0.0-20220407111146-e579adbbc4a2
$ gomobile init
$ gomobile version
gomobile version unknown: binary is out of date, re-install it

@monchote
Copy link

Same issue here:

$ go install golang.org/x/mobile/cmd/gomobile@aaac322
go: downloading golang.org/x/mobile v0.0.0-20220722155234-aaac322e2105
go: downloading golang.org/x/mod v0.4.2
go: downloading golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e
$ gomobile init
$ gomobile version
gomobile version unknown: cannot test gomobile binary: exit status 1, no required module provides package golang.org/x/mobile/cmd/gomobile: go.mod file not found in current directory or any parent directory; see 'go help modules'

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Dec 26, 2022
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Jan 26, 2024
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 NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

9 participants