I initially tried this docker setup for a simple hello world example and that worked. But now I am not sure whether it actually compiled inside docker and communicated the results outside or it just compiled in mac itself.
Gopls listen inside docker doesn't give any logs other than connected and exited (atleast when I run docker logs ).
PS: I execed into docker and built the source and it worked as expected.
What did you expect to see?
I expect gopls -remote to build the source inside docker and give back the results to the client.
What did you see instead?
I see the same build error which I got on mac, which might mean gopls is not forwarding the commands to the remote and doing it locally.
The text was updated successfully, but these errors were encountered:
If you're seeing connection logging from the daemon inside docker, then you are indeed connecting to the daemon and gopls should be forwarding the LSP.
What is the nature of your build error? My guess is that this may be related to the fact that the gopls forwarder also forwards go env, meaning it forwards GOOS. If this is likely to be the problem, you can try running neovim with GOOS=linux to confirm.
Once we figure this out, we should update the env forwarding logic: what you're trying to do seems like a valuable use-case to support.
I'll also note that there may be issues using gopls on go1.12. Our support for Go versions older than the last two releases is best-effort, though we do make sure gopls compiles and tests pass (this is a recent addition to our CI).
BTW, I would expect there to be other problems running the gopls daemon in docker. Namely that the file URIs would be incorrect. However, for darwin->linux it could probably be made to work. I assume you've mounted your workspace at the exact same absolute path.
Links to outside your workspace (in GOROOT or GOPATH) will probably break.
Thanks for the help! GOOS=linux worked.
Yeah on the paths, I have created absolute paths inside docker to make it work and also in docker go is installed in /usr/local/go and the GOROOT=/usr/local/go but in my mac since I have to install a older go it is installed in /usr/local/Cellaremail@example.com/1.12.17/libexec/. Right now I have symlinked to /usr/local/go and changed GOROOT in mac so that both work. But it will be helpful if the go env of the docker is getting used inside except for GOPATH instead of sending it from the host which I don't think makes sense.