Visual Studio Code 是微软推出的一款跨平台的代码编辑器,可以用它作为golang开发的IDE。其下载地址为:下载地址:https://code.visualstudio.com/Download,安装完成之后还需要安装go语言插件。打开Visual Studio Code ,按快捷键CTRL+SHIFT+P,输入Install Extension,然后搜索go,选中go的开发插件安装,安装完毕后重启下IDE即可。
为了便于go的开发,还需要安装一些golang相关的工具。
The extension uses the following tools, installed in the current GOPATH. If any tools are missing, you will see an "Analysis Tools Missing" warning in the bottom right corner of the editor. Clicking it will offer to install the missing tools for you.
gocode: go get -u -v github.com/nsf/gocode
godef: go get -u -v github.com/rogpeppe/godef
golint: go get -u -v github.com/golang/lint/golint
go-find-references: go get -u -v github.com/lukehoban/go-find-references
go-outline: go get -u -v github.com/lukehoban/go-outline
goreturns: go get -u -v sourcegraph.com/sqs/goreturns
gorename: go get -u -v golang.org/x/tools/cmd/gorename
gopkgs: go get -u -v github.com/tpng/gopkgs
go-symbols: go get -u -v github.com/newhook/go-symbols
To install them just paste and run:
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-find-references
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 sdk,git。由于安装的过程会下载一些google的资源,所以你的电脑环境需要能够访问google的相关服务,如果访问不了,请自行搜索翻墙的方法。
参考:https://marketplace.visualstudio.com/items?itemName=lukehoban.Go
有疑问加站长微信联系(非本文作者)