donglao4370 2019-04-08 11:18
浏览 710
已采纳

无法在vscode中自动安装go扩展

I am getting started with Go and would like to use Visual Studio Code for editing. I successfully installed go on my Ubuntu Computer.

My GOPATH (go env) is set to the same value as go.gopath in settings.json. If I run Go: Current GOPATH it outputs the correct path.

However, I am not able to install the go extensions. If I click on Install all I get output similar to this:

Installing 1 tool at home/jan/go/bin
  dlv

Installing github.com/go-delve/delve/cmd/dlv FAILED

1 tools failed to install.

dlv:
Error: Command failed: /snap/bin/go get -u -v github.com/go-delve/delve/cmd/dlv

I seem to be able to just install packages manually with /snap/bin/go get -u -v github.com/go-delve/delve/cmd/dlv. The command runs without errors, but VSCode seems to be unable to find dlv.

My settings.json:

{
    "terminal.integrated.rendererType": "dom",
    "go.useLanguageServer": true,
    "go.formatTool": "gofmt",
    "go.lintOnSave": "file",
    "go.vetOnSave": "package",
    "go.buildOnSave": "package",
    "go.lintTool": "golint",
    "go.gopath": "home/jan/go"
}

I have git installed on my computer. It works without a problem.

  • 写回答

1条回答 默认 最新

  • douxin1163 2019-04-08 13:45
    关注

    Your GOPATH is not set correctly in settings.json.

        "go.gopath": "home/jan/go"
    

    This path is relative, and so it would be appended to whatever your working directory is, with the obvious result of not being able to find the path as it won't exist.

    You can either set it correctly, or delete it and the GOPATH environment variable will be used. (I run it this way.)

        "go.gopath": "/home/jan/go"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?
  • ¥50 invest生境质量模块
  • ¥15 nhanes加权logistic回归,svyglm函数