I am using visual studio code to code in golang.
Here is the code repository. https://github.com/chakpongchung/public/tree/master/rpc/src
It is copied from this document: https://golang.org/pkg/net/rpc/
For this particular example, I cant see any function definition pop-up, nor can I use "go to definition" in vscode by pressing F12. I can see the definition pop-up in other projects in my computer.
I have set my gopath in .bashrc in ubuntu 16.04 using the env.sh
All the plugin and visual studio code version are the latest. What should I do to use the function definition prompt?
update: the problem is now solved by setting:
export GOPATH=`pwd`
instead of:
export GOPATH=${GOPATH}:`pwd`
Thank you all!Though I still have no idea to have multiple gopath working.
This issue is in new versions or updates of vs code. My version is 1.22
, It started working in my vs code when I tried to edit the settings of go extension for Go doc tool in
File > Preferences > Settings > Extensions > Go(Configuration)
Set Docs Tool from godoc
to gogetdoc
. If you have not downloaded gogetdoc
. Download it first and restart vscode for it to load the tool.
go get -u github.com/zmb3/gogetdoc
Now Press F12
to go to definition. I hope it helps.