dongshou9343
2018-12-01 17:38 阅读 52
已采纳

无法下载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 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

    点赞 评论 复制链接分享
  • dongqin5604 dongqin5604 2019-04-13 12:59

    Simply ensure the Git has been added to your PATH environment variable.

    点赞 评论 复制链接分享

相关推荐