vs code golang配置
2019-10-30 本文已影响0人
厚土火焱
go语言能够使用JetBrains出品的Goland是最好的选择。
免费的编辑器,现在选择vs code也是不错的。
使用vs code已经能够很顺畅的写代码了,很早以前阻碍我使用vs code的主要问题就是代码提示,现在也不存在了。
确定你已经安装好了go 语言环境之后,首先安装vs code,直接去官网下载。https://code.visualstudio.com/


在搜索框输入关键字 go,安装 Microsoft提供的go插件。

点击Debug图标,配置调试参数。


第一次配置,会要求你找一个路径存放launch.json

最重要的是要编辑settings.json,点击 File>Preferences>Settings,

找到Extensions>Go configuration,点击任意一个 Edit in settings.json

然后你就可以配置go程序的编辑环境了。

{
"go.buildOnSave": "workspace",
"go.lintOnSave": "package",
"go.vetOnSave": "package",
"go.buildTags": "",
"go.buildFlags": [],
"go.lintFlags": [],
"go.vetFlags": [],
"go.coverOnSave":true,
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.formatTool": "goreturns",
"go.gocodeAutoBuild": true,
"go.gocodePackageLookupMode": "go",
"go.autocompleteUnimportedPackages": true,
"go.gotoSymbol.includeImports": true,
"go.inferGopath": true,
"files.autoSave": "onFocusChange",
"go.goroot": "c:\\go\\",
"go.gopath": "f:\\mygo",
"window.zoomLevel": 0,
"workbench.colorTheme": "Quiet Light",
"team.showWelcomeMessage": false,
"files.autoGuessEncoding": true,
"workbench.iconTheme": "vscode-icons",
"editor.mouseWheelZoom": true,
"terminal.integrated.rendererType": "dom",
"editor.wordWrap": "on",
"editor.fontSize": 22
}
然后,你就可以愉快的用 vs code 写 go 程序了。
