Open malkhamis opened 5 years ago
Thanks for pointing this out. We do, indeed, just take the first project path.
In a multi-project workspace it turns out to be difficult to tell which project a particular editor is associated with. The very first time isn't too tricky, as you can expect the file to live inside the project directory, but from there if you navigate to a dependency (in GOPATH or the module cache) then you cant simply look at the path of the open file.
I see what you are saying... If this is difficult to fix, then may I suggest that this is mentioned in go-plus documentation somehow ? I think this will save other users a lot of guess work in regards of why it may not be working :)
@malkhamis I agree, because I spend up to 1 hour to understand what's the reason.
My STR: 2 projects. The First one is a react native and the second one is a golang api. So when I move golang project on top in the atom tree view, documentation feature works.
Same Issue here, I had an Opencv.js webapp in one project and a golang api in the other. This should be mentioned in go-plus documentation
Atom version 1.49
I have the exact same issue, except my project tab contains only 1 directory but I'm getting the same behavior and the same output to the atom console when I hover over any piece of code.
Any suggestions on how to fix this? It's driving me a little crazy.
Prerequisites
atom .
from the terminal in your project's directory?go env
is correct? If it is, please include the output in this issue.Description
The problem manifests itself when Atom's Project tab contains multiple directories such that all directories are separate projects with their own
go.mod
file. I noticed that generating documentations (either by hovering or by pressingalt-d
on the symbol only worked for a single project. The following output whenever a request for documentation is served was observed inConsole: go-plus
:Initially, I suspected that this is related to this issue in golang/cmd. However, it turned out that the problem only happens when there are multiple directories in Atom's Project tab. For some reason, go-plus assumes (maybe?) that the first directory in the Project tab is the only project and environment variable
GOMOD
gets set to the absolute path of thego.mod
file for that project. If I navigate to another project in that same Atom instance and request documentation for a symbol, go-plus gets stuck showingGenerating documentation...
forever without giving back any results for showing documentation. Of course, I also observe errorgo: directory ../[repo] outside available modules
in the console.To confirm the above, I tried to move one directory up in the Project tab and reloaded Atom. I observed that
GOMOD
is now set to the other project that was moved up in the list and requests for documentations are served as expectedOutput from
atom -v && apm -v
Output From
go env
GOARCH="amd64" GOBIN="" GOCACHE="/home/malkhamis/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/malkhamis/go" GOPROXY="" GORACE="" GOROOT="/usr/lib/golang" GOTMPDIR="" GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/malkhamis/[...]/github.com/[org]/[repo]/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build474342128=/tmp/go-build -gno-record-gcc-switches"
Steps to Reproduce
go.mod
filealt-d
Expected Behavior
Should be able to generate docs for any project in the Project tab without the need to move the project up in the list and reload Atom
Actual Behavior
Gets stuck showing
Generating Documentation...