Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
x/mobile: local import "." in non-local package #29368
What version of Go are you using (
Since the error was coming from a file generated by gobind, I reverted my gobind binary to one that was working on the earlier version of Go. While remaining under go1.11.4 with GO111MODULE=off I tried the build. Instead of an error gobind simply goes into a cpu/ram consuming spin, I let it eat 4gb until I killed it.
Next I reverted the gomobile binary as well, tried again, same thing. Then I kept the older gomobile binary but used the newer gobind binary, and I get the error in my original post. Removing GO111MODULE=off (in order to use modules) with the older binaries does the same thing, cpu/ram continue to grow until I kill it.
I'm not sure what's changed between the older binaries and the newer ones, but neither are working for me with go1.11.4 under any circumstance, go modules or otherwise. I'm still looking for a workaround.
Alright well after losing most of the day to this, I have discovered what was wrong and a workaround.
I tested the above setup again with go1.10.7 and was getting the same problems, which didn't make sense to me since I had just used gomobile not long before with 1.10.5 and it was fine, then I realized something. In the past I've used gomobile to build/bind in my current directory, however at the time I've always been inside GOPATH (been using Go since 1.3). When I moved to go1.11.4 I also decided to create this new project outside of GOPATH. When I tested GO111MODULE=off my current directory was still outside of GOPATH even though I reinstalled all my dependencies in GOPATH and go build was working fine. When I read that gomobile doesn't work with modules yet in the other issue, I thought that meant my dependencies had to be in GOPATH as they always have been (leading to the situation in my previous post). I didn't think that meant my current working directory also had to be in GOPATH. I knew go mods allowed you to work outside of GOPATH, but I didn't make a connection that the working directory for gomobile would also be a problem since again, go build was fine outside of it, the original error in the other issue was about gomobile unable to find deps, and the error I was getting simply mentioned a local import in a non local package (not very helpful).
The workaround for now, along with continuing to use GO111MODULE=off, was to create a symlink from my GOPATH to my current working directory. Then it built fine. Hopefully this helps someone else, and maybe some documentation on this (if it is even needed after mod support is added) in the future would be appreciated.