解决在VS Code上安装Golang包时遇到的错误

环境

    • windows 10

 

    • Golang 1.12.9

 

    • VS Code

 

    • # 問題

 

    VS Code上でGolangのパッケージをインストールする時に、表示されたエラーは以下。
//一部分のみ記載
Installing 16 tools at C:\Users\~\go\bin


  gocode

Installing github.com/mdempsky/gocode FAILED

16 tools failed to install.

gocode:
Error: Command failed: C:\Program Files\Go\bin\go.exe get -u -v github.com/mdempsky/gocode
github.com/mdempsky/gocode (download)
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/mdempsky/gocode: exec: "git": executable file not found in %PATH%
github.com/mdempsky/gocode (download)
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/mdempsky/gocode: exec: "git": executable file not found in %PATH%

解决方案 cè)

当你读取错误消息时,

    • Gitがインストールされていない

 

    GitのPATHが通っていない

由于某个问题,打开命令提示符进行确认。

git --version

由于Git已安装但未被识别,因此需要将其添加到路径中。

重新尝试安装Golang包,并出现以下显示。

All tools successfully installed. You're ready to Go :).

以上是成功完成安装的。

bannerAds