douren4075 2017-01-29 02:22
浏览 177

没有“转到定义”,也没有弹出针对golang代码的函数定义

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.

  • 写回答

1条回答 默认 最新

  • douduan1953 2018-11-19 08:39
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统