VS Code can't install the Go tools

前端 未结 3 1167
再見小時候
再見小時候 2021-02-10 20:18

I try to start using Go in VSCode. I\'ve installed Go as well as Git and created a project in Code, containing a single .go file.

When I type something, VSC

3条回答
  •  一整个雨季
    2021-02-10 20:51

    It looks like it's complaining due to C:\Users\user\go\src\golang.org\x\tools being not a git repo, so it can't update whatever is in it.

    Assuming you didn't put your own code in that dir, try removing it and then running again.

    If you look at the docs for the Go plugin, and scroll all the way to the bottom, it shows the commands to run if you want to manually install/upgrade the stuff the plugin needs.

    Specifically, taken from their github repo, you can just run this from a cmd.exe prompt.

    go get -u -v github.com/nsf/gocode
    go get -u -v github.com/rogpeppe/godef
    go get -u -v github.com/zmb3/gogetdoc
    go get -u -v github.com/golang/lint/golint
    go get -u -v github.com/lukehoban/go-outline
    go get -u -v sourcegraph.com/sqs/goreturns
    go get -u -v golang.org/x/tools/cmd/gorename
    go get -u -v github.com/tpng/gopkgs
    go get -u -v github.com/newhook/go-symbols
    go get -u -v golang.org/x/tools/cmd/guru
    go get -u -v github.com/cweill/gotests/...
    go get -u -v golang.org/x/tools/cmd/godoc
    go get -u -v github.com/fatih/gomodifytags
    

提交回复
热议问题