vscode编辑器golang调试

前端之家收集整理的这篇文章主要介绍了vscode编辑器golang调试前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

安装vscode

安装vscode-go 插件

进入vscode界面,打开命令面板Ctrl + Shift + P,输入install,

插件特性包括:

Completion Lists (using gocode)
Signature Help (using godoc)
Snippets
Quick Info (using godef)
Goto Definition (using godef)
Find References (using guru)
File outline (using go-outline)
Workspace symbol search (using go-symbols)
Rename (using gorename)
Build-on-save (using go build and go test)
Lint-on-save (using golint or goMetalinter)
Format (using goreturns or goimports or gofmt)
Generate unit tests squeleton (using gotests)
Add Imports (using gopkgs)
[partially implemented] Debugging (using delve)

手动安装

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-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/...
手动安装中 vscode配置

启动vscode后选择 文件菜单 -> 首选项 -> 工作区设置
在打开的.vscode/settings.json文件

{
    "go.buildOnSave": true,"go.lintOnSave": true,"go.vetOnSave": true,"go.buildTags": "","go.buildFlags": [],"go.lintTool": "golint","go.lintFlags": [],"go.vetFlags": [],"go.coverOnSave": false,"go.useCodeSnippetsOnFunctionSuggest": false,"go.formatOnSave": true,"go.formatTool": "goreturns","go.formatFlags": [],"go.goroot": "/usr/local/go","go.gopath": "/Users/lukeh/go","go.gocodeAutoBuild": false }

vscode编辑器快捷键

命令面板 Ctrl + Shift + P
转到文件 Ctrl + P
切换终端 Ctrl + `
重命名 F2
调试   F5(continue)F10(step over)F11(step into)
跳到下一个有error或者warning的地方 F8 
跳到function定义的地方 F12
缩放整个画面 Cmd +/Ctrl +

好用的插件

vscode-icons

原文链接:https://www.f2er.com/go/189271.html

猜你在找的Go相关文章