dongshou9343 2018-12-01 17:38
浏览 71
已采纳

无法下载Go with Visual Studio所需的分析工具

I am a total newbie and only just kicked off a beginners course on Go and failing at first hurdle of installation of all the bits you need to make it work so sorry if this is a dumb question. I've installed Go, Git and Visual Studio... After first installing Visual Studio I am trying to install the 12 Analysis tools for Go but everytime i try this it fails. Generally related to a "permission denied" error. Error message below. Any ideas why?

Installing 12 tools at /Documents/go/bin gocode gopkgs
go-outline go-symbols guru gorename dlv gocode-gomod godef godef-gomod goreturns golint

Installing github.com/mdempsky/gocode FAILED Installing github.com/uudashr/gopkgs/cmd/gopkgs FAILED Installing github.com/ramya-rao-a/go-outline FAILED Installing github.com/acroca/go-symbols FAILED Installing golang.org/x/tools/cmd/guru FAILED Installing golang.org/x/tools/cmd/gorename FAILED Installing github.com/derekparker/delve/cmd/dlv FAILED Installing github.com/stamblerre/gocode FAILED Installing github.com/rogpeppe/godef FAILED Installing github.com/ianthehat/godef FAILED Installing github.com/sqs/goreturns FAILED Installing golang.org/x/lint/golint FAILED

12 tools failed to install.

gocode: Error: Command failed: /usr/local/go/bin/go get -u -v github.com/mdempsky/gocode github.com/mdempsky/gocode (download) package github.com/mdempsky/gocode: mkdir /Documents/go: permission denied github.com/mdempsky/gocode (download) package github.com/mdempsky/gocode: mkdir /Documents/go: permission denied

gopkgs: Error: Command failed: /usr/local/go/bin/go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs github.com/uudashr/gopkgs (download) package github.com/uudashr/gopkgs/cmd/gopkgs: mkdir /Documents/go: permission denied github.com/uudashr/gopkgs (download) package github.com/uudashr/gopkgs/cmd/gopkgs: mkdir /Documents/go: permission denied

  • 写回答

2条回答 默认 最新

  • dongma0722 2018-12-01 18:11
    关注

    I don't use visual studio for golang so may be of limited use here if it is visual studio specific - but I've heard nothing but good things so its probably not...

    I suspect the issue is that your GOPATH is set to /Documents/go whereas you have placed your GOPATH in the Documents folder for your user. it should probably be something like %My Documents%/go or the full path to that location e.g something like /c/Users/{your user}/Documents.

    Note: I have used nix style paths - as your output does, but when setting them via windows gui you should use windows conventions, e.g C:\Users\...

    To diagnose further I would first cut the ide out of the equation and jump to the command line.

    type go env to check your paths, look particularly at GOPATH which I suspect is your problem. If it is incorrect you should change it in environment variables (google change environment variables for you windows version) - as per note above follow the conventions of the other environment variables for setting the path (windows style specification, e.g c:\Users\)

    if go env doesn't work you have a bigger issue with your go install

    If you are still having issues, please update your question, providing the output of go env as well as an outline of how you installed go (Note: I think the MSI installer takes care of it all for you)

    if go env looks fine to you, another debug step would be to attempt to install one of your tools manually from the command line and see what happens, e.g:

    go get -u -v github.com/mdempsky/gocode

    but if go env doesn't work that wont either and the issue is likely that your main go binary is not in you systems PATH environment variable but it doesn't look like that

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大