前言
VSCode现在已经发展的相当完善,很多语言都比较推荐使用其来编写,Go语言也一样,前提你电脑已经有了Go环境和最新版本的VSCode
插件安装
直接在拓展插件中搜索Go,就可以安装Go插件
安装之后vscode会弹出该插件还需安装一些扩展工具支持,但是这些工具往往会下载失败,或者仅仅成功一部分
比如:
Installing github.com/nsf/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 github.com/rogpeppe/godef FAILED
Installing github.com/sqs/goreturns FAILED
Installing github.com/golang/lint/golint FAILED
Installing github.com/derekparker/delve/cmd/dlv FAILEDInstalling golang.org/x/tools/cmd/guru FAILED
Installing golang.org/x/tools/cmd/gorename FAILED
%GOPATH%\srcgithub.com
git clone%GOPATH%go installgo install github.com/nsf/gocode
go install github.com/uudashr/gopkgs/cmd/gopkgsgo install github.com/uudashr/gopkgs/cmd/gopkgs
golang.org/x/git clone https://github.com/golang/tools.git tools%GOPATH%go install XXX
Debug配置
如下如打开json配置文件
将下面的配置复制到json中去
配置好以后,就可以直接按F5进行调试运行了
原文链接:https://www.cnblogs.com/WindSun/p/12195944.html